errno = 0;
return NULL;
}
- if ((port != 0) &&
- (GNUNET_NETWORK_socket_setsockopt
- (sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) != GNUNET_OK))
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
- "setsockopt");
+ if (port != 0)
+ {
+ if (GNUNET_NETWORK_socket_setsockopt
+ (sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) != GNUNET_OK)
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
+ "setsockopt");
+#ifdef IPV6_V6ONLY
+ if ( (serverAddr->sa_family == AF_INET6) &&
+ (GNUNET_NETWORK_socket_setsockopt
+ (sock, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof (on)) != GNUNET_OK) )
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
+ "setsockopt");
+#endif
+ }
/* bind the socket */
if (GNUNET_NETWORK_socket_bind (sock, serverAddr, socklen) != GNUNET_OK)
{
(client->shutdown_now == GNUNET_YES) ||
(GNUNET_YES != client->check (client->client_closure)))
{
- /* other side closed connection, error connecting, etc. */
+ /* other side closed connection, error connecting, etc. */
GNUNET_SERVER_client_disconnect (client);
return;
}
{
struct GNUNET_CONNECTION_Handle *sock = cls;
if (persist == GNUNET_YES)
- GNUNET_CONNECTION_persist_ (sock);
-
+ GNUNET_CONNECTION_persist_ (sock);
GNUNET_CONNECTION_destroy (sock, GNUNET_NO);
}
}
}
if (rc > 0)
- return;
+ {
+#if DEBUG_SERVER
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "RC still positive, not destroying everything.\n");
+#endif
+ return;
+ }
if (client->in_process_client_buffer == GNUNET_YES)
- return;
+ {
+#if DEBUG_SERVER
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Still processing inputs, not destroying everything.\n");
+#endif
+ return;
+ }
client->destroy (client->client_closure, client->persist);
GNUNET_free (client);
}