]> granicus.if.org Git - curl/commitdiff
log each setsockopt/SO_REUSEADDR failure
authorYang Tse <yangsita@gmail.com>
Wed, 13 May 2009 19:20:45 +0000 (19:20 +0000)
committerYang Tse <yangsita@gmail.com>
Wed, 13 May 2009 19:20:45 +0000 (19:20 +0000)
tests/server/sockfilt.c

index 97e2e4ce0abbac18b509f9a4b4c9219a831c2891..2abdaa0df3342c7f5bc76a1d72efba1553ab0fdb 100644 (file)
@@ -688,13 +688,16 @@ static curl_socket_t sockdaemon(curl_socket_t sock,
   int delay= 20;
   int attempt = 0;
   int error = 0;
+  curl_socklen_t optlen;
 
   do {
     attempt++;
+    optlen = sizeof(flag);
     rc = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
-         (void *)&flag, sizeof(flag));
+         (void *)&flag, optlen);
     if(rc) {
       error = SOCKERRNO;
+      logmsg("setsockopt/SO_REUSEADDR failed: (%d) %s", error, strerror(error));
       if(maxretr) {
         rc = wait_ms(delay);
         if(rc) {