Explorar el Código

BSocket: compile when IPV6_RECVPKTINFO doesn't exist. Don't fail if we fail to setup pktinfo.

ambrop7 hace 15 años
padre
commit
3aeb316d0a
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  1. 4 2
      system/BSocket.c

+ 4 - 2
system/BSocket.c

@@ -129,8 +129,12 @@ static int set_pktinfo6 (int s)
     DWORD opt = 1;
     DWORD opt = 1;
     int res = setsockopt(s, IPPROTO_IPV6, IPV6_PKTINFO, (char *)&opt, sizeof(opt));
     int res = setsockopt(s, IPPROTO_IPV6, IPV6_PKTINFO, (char *)&opt, sizeof(opt));
     #else
     #else
+    # ifdef IPV6_RECVPKTINFO
     int opt = 1;
     int opt = 1;
     int res = setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &opt, sizeof(opt));
     int res = setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &opt, sizeof(opt));
+    # else
+    int res = 0; // assume it succeeded
+    # endif
     #endif
     #endif
     return res;
     return res;
 }
 }
@@ -690,7 +694,6 @@ int BSocket_Init (BSocket *bs, BReactor *bsys, int domain, int type)
     // set pktinfo if needed
     // set pktinfo if needed
     if (!setup_pktinfo(fd, type, domain)) {
     if (!setup_pktinfo(fd, type, domain)) {
         DEBUG("setup_pktinfo failed");
         DEBUG("setup_pktinfo failed");
-        goto fail1;
     }
     }
     
     
     // setup winsock exts
     // setup winsock exts
@@ -1133,7 +1136,6 @@ int BSocket_Accept (BSocket *bs, BSocket *newsock, BAddr *addr)
         // set pktinfo if needed
         // set pktinfo if needed
         if (!setup_pktinfo(fd, bs->type, bs->domain)) {
         if (!setup_pktinfo(fd, bs->type, bs->domain)) {
             DEBUG("setup_pktinfo failed");
             DEBUG("setup_pktinfo failed");
-            goto fail0;
         }
         }
         
         
         // setup winsock exts
         // setup winsock exts