aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r--src/microhttpd/daemon.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 2bbb7b2a..fae617a1 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -302,7 +302,7 @@ MHD_ip_limit_add (struct MHD_Daemon *daemon,
302 MHD_ip_count_lock (daemon); 302 MHD_ip_count_lock (daemon);
303 303
304 /* Search for the IP address */ 304 /* Search for the IP address */
305 if (NULL == (nodep = TSEARCH (key, 305 if (NULL == (nodep = tsearch (key,
306 &daemon->per_ip_connection_count, 306 &daemon->per_ip_connection_count,
307 &MHD_ip_addr_compare))) 307 &MHD_ip_addr_compare)))
308 { 308 {
@@ -358,7 +358,7 @@ MHD_ip_limit_del (struct MHD_Daemon *daemon,
358 MHD_ip_count_lock (daemon); 358 MHD_ip_count_lock (daemon);
359 359
360 /* Search for the IP address */ 360 /* Search for the IP address */
361 if (NULL == (nodep = TFIND (&search_key, 361 if (NULL == (nodep = tfind (&search_key,
362 &daemon->per_ip_connection_count, 362 &daemon->per_ip_connection_count,
363 &MHD_ip_addr_compare))) 363 &MHD_ip_addr_compare)))
364 { 364 {
@@ -375,7 +375,7 @@ MHD_ip_limit_del (struct MHD_Daemon *daemon,
375 /* Remove the node entirely if count reduces to 0 */ 375 /* Remove the node entirely if count reduces to 0 */
376 if (0 == --found_key->count) 376 if (0 == --found_key->count)
377 { 377 {
378 TDELETE (found_key, 378 tdelete (found_key,
379 &daemon->per_ip_connection_count, 379 &daemon->per_ip_connection_count,
380 &MHD_ip_addr_compare); 380 &MHD_ip_addr_compare);
381 free (found_key); 381 free (found_key);
@@ -850,7 +850,7 @@ recv_param_adapter (struct MHD_Connection *connection,
850 MHD_set_socket_errno_ (ENOTCONN); 850 MHD_set_socket_errno_ (ENOTCONN);
851 return -1; 851 return -1;
852 } 852 }
853 ret = RECV (connection->socket_fd, other, i, MSG_NOSIGNAL); 853 ret = recv (connection->socket_fd, other, i, MSG_NOSIGNAL);
854#if EPOLL_SUPPORT 854#if EPOLL_SUPPORT
855 if (ret < (ssize_t) i) 855 if (ret < (ssize_t) i)
856 { 856 {
@@ -889,7 +889,7 @@ send_param_adapter (struct MHD_Connection *connection,
889 return -1; 889 return -1;
890 } 890 }
891 if (0 != (connection->daemon->options & MHD_USE_SSL)) 891 if (0 != (connection->daemon->options & MHD_USE_SSL))
892 return SEND (connection->socket_fd, other, i, MSG_NOSIGNAL); 892 return send (connection->socket_fd, other, i, MSG_NOSIGNAL);
893#if LINUX 893#if LINUX
894 if ( (connection->write_buffer_append_offset == 894 if ( (connection->write_buffer_append_offset ==
895 connection->write_buffer_send_offset) && 895 connection->write_buffer_send_offset) &&
@@ -926,7 +926,7 @@ send_param_adapter (struct MHD_Connection *connection,
926 http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */ 926 http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */
927 } 927 }
928#endif 928#endif
929 ret = SEND (connection->socket_fd, other, i, MSG_NOSIGNAL); 929 ret = send (connection->socket_fd, other, i, MSG_NOSIGNAL);
930#if EPOLL_SUPPORT 930#if EPOLL_SUPPORT
931 if (ret < (ssize_t) i) 931 if (ret < (ssize_t) i)
932 { 932 {
@@ -1707,7 +1707,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
1707#if HAVE_ACCEPT4 1707#if HAVE_ACCEPT4
1708 s = accept4 (fd, addr, &addrlen, SOCK_CLOEXEC | nonblock); 1708 s = accept4 (fd, addr, &addrlen, SOCK_CLOEXEC | nonblock);
1709#else 1709#else
1710 s = ACCEPT (fd, addr, &addrlen); 1710 s = accept (fd, addr, &addrlen);
1711#endif 1711#endif
1712 if ((MHD_INVALID_SOCKET == s) || (addrlen <= 0)) 1712 if ((MHD_INVALID_SOCKET == s) || (addrlen <= 0))
1713 { 1713 {
@@ -1814,7 +1814,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
1814 if (MHD_INVALID_SOCKET != pos->socket_fd) 1814 if (MHD_INVALID_SOCKET != pos->socket_fd)
1815 { 1815 {
1816#ifdef WINDOWS 1816#ifdef WINDOWS
1817 SHUTDOWN (pos->socket_fd, SHUT_WR); 1817 shutdown (pos->socket_fd, SHUT_WR);
1818#endif 1818#endif
1819 if (0 != MHD_socket_close_ (pos->socket_fd)) 1819 if (0 != MHD_socket_close_ (pos->socket_fd))
1820 MHD_PANIC ("close failed\n"); 1820 MHD_PANIC ("close failed\n");
@@ -3082,11 +3082,11 @@ create_socket (struct MHD_Daemon *daemon,
3082 3082
3083 /* use SOCK_STREAM rather than ai_socktype: some getaddrinfo 3083 /* use SOCK_STREAM rather than ai_socktype: some getaddrinfo
3084 * implementations do not set ai_socktype, e.g. RHL6.2. */ 3084 * implementations do not set ai_socktype, e.g. RHL6.2. */
3085 fd = SOCKET (domain, ctype, protocol); 3085 fd = socket (domain, ctype, protocol);
3086 if ( (MHD_INVALID_SOCKET == fd) && (EINVAL == MHD_socket_errno_) && (0 != SOCK_CLOEXEC) ) 3086 if ( (MHD_INVALID_SOCKET == fd) && (EINVAL == MHD_socket_errno_) && (0 != SOCK_CLOEXEC) )
3087 { 3087 {
3088 ctype = type; 3088 ctype = type;
3089 fd = SOCKET(domain, type, protocol); 3089 fd = socket(domain, type, protocol);
3090 } 3090 }
3091 if (MHD_INVALID_SOCKET == fd) 3091 if (MHD_INVALID_SOCKET == fd)
3092 return MHD_INVALID_SOCKET; 3092 return MHD_INVALID_SOCKET;
@@ -3440,10 +3440,10 @@ MHD_start_daemon_va (unsigned int flags,
3440#endif 3440#endif
3441 goto free_and_fail; 3441 goto free_and_fail;
3442 } 3442 }
3443 if ( (0 > SETSOCKOPT (socket_fd, 3443 if ( (0 > setsockopt (socket_fd,
3444 SOL_SOCKET, 3444 SOL_SOCKET,
3445 SO_REUSEADDR, 3445 SO_REUSEADDR,
3446 &on, sizeof (on))) && 3446 (void*)&on, sizeof (on))) &&
3447 (0 != (flags & MHD_USE_DEBUG)) ) 3447 (0 != (flags & MHD_USE_DEBUG)) )
3448 { 3448 {
3449#if HAVE_MESSAGES 3449#if HAVE_MESSAGES
@@ -3501,7 +3501,7 @@ MHD_start_daemon_va (unsigned int flags,
3501 const char 3501 const char
3502#endif 3502#endif
3503 on = (MHD_USE_DUAL_STACK != (flags & MHD_USE_DUAL_STACK)); 3503 on = (MHD_USE_DUAL_STACK != (flags & MHD_USE_DUAL_STACK));
3504 if ( (0 > SETSOCKOPT (socket_fd, 3504 if ( (0 > setsockopt (socket_fd,
3505 IPPROTO_IPV6, IPV6_V6ONLY, 3505 IPPROTO_IPV6, IPV6_V6ONLY,
3506 &on, sizeof (on))) && 3506 &on, sizeof (on))) &&
3507 (0 != (flags & MHD_USE_DEBUG)) ) 3507 (0 != (flags & MHD_USE_DEBUG)) )
@@ -3515,7 +3515,7 @@ MHD_start_daemon_va (unsigned int flags,
3515#endif 3515#endif
3516#endif 3516#endif
3517 } 3517 }
3518 if (-1 == BIND (socket_fd, servaddr, addrlen)) 3518 if (-1 == bind (socket_fd, servaddr, addrlen))
3519 { 3519 {
3520#if HAVE_MESSAGES 3520#if HAVE_MESSAGES
3521 if (0 != (flags & MHD_USE_DEBUG)) 3521 if (0 != (flags & MHD_USE_DEBUG))
@@ -3545,7 +3545,7 @@ MHD_start_daemon_va (unsigned int flags,
3545 } 3545 }
3546 } 3546 }
3547#endif 3547#endif
3548 if (LISTEN (socket_fd, 32) < 0) 3548 if (listen (socket_fd, 32) < 0)
3549 { 3549 {
3550#if HAVE_MESSAGES 3550#if HAVE_MESSAGES
3551 if (0 != (flags & MHD_USE_DEBUG)) 3551 if (0 != (flags & MHD_USE_DEBUG))
@@ -3860,7 +3860,7 @@ close_all_connections (struct MHD_Daemon *daemon)
3860 (0 != pthread_mutex_lock (&daemon->cleanup_connection_mutex)) ) 3860 (0 != pthread_mutex_lock (&daemon->cleanup_connection_mutex)) )
3861 MHD_PANIC ("Failed to acquire cleanup mutex\n"); 3861 MHD_PANIC ("Failed to acquire cleanup mutex\n");
3862 for (pos = daemon->connections_head; NULL != pos; pos = pos->nextX) 3862 for (pos = daemon->connections_head; NULL != pos; pos = pos->nextX)
3863 SHUTDOWN (pos->socket_fd, 3863 shutdown (pos->socket_fd,
3864 (pos->read_closed == MHD_YES) ? SHUT_WR : SHUT_RDWR); 3864 (pos->read_closed == MHD_YES) ? SHUT_WR : SHUT_RDWR);
3865 if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && 3865 if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
3866 (0 != pthread_mutex_unlock (&daemon->cleanup_connection_mutex)) ) 3866 (0 != pthread_mutex_unlock (&daemon->cleanup_connection_mutex)) )
@@ -3956,7 +3956,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
3956 { 3956 {
3957 /* fd might be MHD_INVALID_SOCKET here due to 'MHD_quiesce_daemon' */ 3957 /* fd might be MHD_INVALID_SOCKET here due to 'MHD_quiesce_daemon' */
3958 if (MHD_INVALID_SOCKET != fd) 3958 if (MHD_INVALID_SOCKET != fd)
3959 (void) SHUTDOWN (fd, SHUT_RDWR); 3959 (void) shutdown (fd, SHUT_RDWR);
3960 } 3960 }
3961#endif 3961#endif
3962#if EPOLL_SUPPORT 3962#if EPOLL_SUPPORT