Просмотр исходного кода

BSocket: set control data pointer for WSASendMsg to NULL if there is no control data; fixes UDP transport on Windows 7

ambrop7 15 лет назад
Родитель
Сommit
b6ab08596c
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      system/BSocket.c

+ 5 - 0
system/BSocket.c

@@ -1198,6 +1198,11 @@ int BSocket_SendToFrom (BSocket *bs, uint8_t *data, int len, BAddr *addr, BIPAdd
         
         msg.Control.len = sum;
         
+        // WSASendMsg chokes on empty control block
+        if (msg.Control.len == 0) {
+            msg.Control.buf = NULL;
+        }
+        
         if (bs->WSASendMsg(bs->socket, &msg, 0, &bytes, NULL, NULL) != 0) {
             int error;
             switch ((error = WSAGetLastError())) {