diff options
author | Luciano Iam <lucianito@gmail.com> | 2020-02-22 20:04:43 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-02-22 23:10:25 +0100 |
commit | d7ef188aead1bea1634d5f9ed63d359c79b384ec (patch) | |
tree | ad6418f46eb530477a5fbf57f87f5c435c2b9d60 /libs | |
parent | 5abce5aae5adff9163c1605be556975ef5037dd2 (diff) |
Prefix events with LWS_
Diffstat (limited to 'libs')
-rw-r--r-- | libs/surfaces/websockets/server.cc | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/libs/surfaces/websockets/server.cc b/libs/surfaces/websockets/server.cc index 80c8113c42..c5b557a0c5 100644 --- a/libs/surfaces/websockets/server.cc +++ b/libs/surfaces/websockets/server.cc @@ -163,7 +163,7 @@ WebsocketsServer::mod_poll_fd (struct lws_pollargs *pa) it->second.lws_pfd.events = pa->events; - if (pa->events & POLLOUT) { + if (pa->events & LWS_POLLOUT) { // libwebsockets wants to write but cannot find a way to update // an existing glib::iosource event flags using glibmm, // create another iosource and set to IO_OUT, it will be destroyed @@ -301,18 +301,14 @@ WebsocketsServer::io_handler (Glib::IOCondition ioc, lws_sockfd_type fd) IOCondition WebsocketsServer::events_to_ioc (int events) { - IOCondition ioc = Glib::IO_ERR; - - if (events & POLLIN) { - ioc |= Glib::IO_IN; - } - - if (events & POLLOUT) { - ioc |= Glib::IO_OUT; - } - - if (events & POLLHUP) { - ioc |= Glib::IO_HUP; + IOCondition ioc; + + if (events & LWS_POLLIN) { + ioc = Glib::IO_IN; + } else if (events & LWS_POLLOUT) { + ioc = Glib::IO_OUT; + } else if (events & LWS_POLLHUP) { + ioc = Glib::IO_HUP; } return ioc; @@ -324,19 +320,15 @@ WebsocketsServer::ioc_to_events (IOCondition ioc) int events = 0; if (ioc & Glib::IO_IN) { - events |= POLLIN; + events |= LWS_POLLIN; } if (ioc & Glib::IO_OUT) { - events |= POLLOUT; - } - - if (ioc & Glib::IO_HUP) { - events |= POLLHUP; + events |= LWS_POLLOUT; } - if (ioc & Glib::IO_ERR) { - events |= POLLERR; + if (ioc & (Glib::IO_HUP | Glib::IO_ERR)) { + events |= LWS_POLLHUP; } return events; |