sync with main mongoose branch, includes all our patches so far as well (nw)

This commit is contained in:
Miodrag Milanovic 2014-06-16 10:05:00 +00:00
parent 1c0b5ad7ab
commit 9660d58c21

View File

@ -147,6 +147,8 @@ union socket_address {
struct sockaddr_in sin;
#ifdef NS_ENABLE_IPV6
struct sockaddr_in6 sin6;
#else
struct sockaddr sin6;
#endif
};
@ -338,7 +340,7 @@ void *ns_start_thread(void *(*f)(void *), void *p) {
(void) pthread_attr_init(&attr);
(void) pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
#if NS_STACK_SIZE > 1
#if defined(NS_STACK_SIZE) && NS_STACK_SIZE > 1
(void) pthread_attr_setstacksize(&attr, NS_STACK_SIZE);
#endif
@ -557,7 +559,7 @@ static sock_t ns_open_listening_socket(union socket_address *sa) {
!setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *) &on, sizeof(on)) &&
#endif
!bind(sock, &sa->sa, sa->sa.sa_family == AF_INET ?
sizeof(sa->sin) : sizeof(sa->sa)) &&
sizeof(sa->sin) : sizeof(sa->sin6)) &&
!listen(sock, SOMAXCONN)) {
ns_set_non_blocking_mode(sock);
// In case port was set to 0, get the real port number