mirror of
https://git.savannah.nongnu.org/git/exosip.git
synced 2026-01-12 00:19:10 +08:00
[ENABLE_MAIN_SOCKET]
When compiled with ENABLE_MAIN_SOCKET, exosip will be listening to incoming TCP and TLS connections. This commit fix the epoll implementation: * new socket must not have EPOLLOUT * we make sure to read the main socket when an event is detected within the osip socket table otherwise, the main socket is never read. Signed-off-by: Aymeric Moizard <amoizard@gmail.com>
This commit is contained in:
@@ -685,7 +685,7 @@ static int _tcp_read_tcp_main_socket(struct eXosip_t *excontext) {
|
||||
int res;
|
||||
|
||||
memset(&ev, 0, sizeof(struct epoll_event));
|
||||
ev.events = EPOLLIN | EPOLLOUT;
|
||||
ev.events = EPOLLIN;
|
||||
ev.data.fd = sock;
|
||||
res = epoll_ctl(excontext->epfd, EPOLL_CTL_ADD, sock, &ev);
|
||||
|
||||
|
||||
@@ -2264,7 +2264,7 @@ static int _tls_read_tls_main_socket(struct eXosip_t *excontext) {
|
||||
int res;
|
||||
|
||||
memset(&ev, 0, sizeof(struct epoll_event));
|
||||
ev.events = EPOLLIN | EPOLLOUT;
|
||||
ev.events = EPOLLIN;
|
||||
ev.data.fd = sock;
|
||||
res = epoll_ctl(excontext->epfd, EPOLL_CTL_ADD, sock, &ev);
|
||||
|
||||
|
||||
@@ -1850,6 +1850,11 @@ int _eXosip_read_message(struct eXosip_t *excontext, int max_message_nb, int sec
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MAIN_SOCKET
|
||||
/* we call this anyway for incoming connection on MAIN socket */
|
||||
/* TODO: also use this code in standard version? */
|
||||
excontext->eXtl_transport.tl_epoll_read_message(excontext, nfds, excontext->ep_array);
|
||||
#else
|
||||
for (i = 0; osip_fd_table[i] != -1; i++) {
|
||||
for (n = 0; n < nfds; ++n) {
|
||||
if (((excontext->ep_array[n].events & EPOLLIN) || (excontext->ep_array[n].events & EPOLLOUT)) && excontext->ep_array[n].data.fd == osip_fd_table[i]) {
|
||||
@@ -1861,6 +1866,7 @@ int _eXosip_read_message(struct eXosip_t *excontext, int max_message_nb, int sec
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
eXosip_lock(excontext);
|
||||
i = _eXosip_dnsutils_checksock_epoll(excontext, nfds);
|
||||
|
||||
Reference in New Issue
Block a user