Cleanup forward declaration in main.h
[novacoin.git] / src / stun.cpp
index 4bcc514..4a34a8c 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
-#ifdef WIN32
-#include <winsock2.h>
-#else
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#endif
 #ifndef WIN32
 #include <unistd.h>
 #endif
@@ -464,11 +456,6 @@ static int StunRequest2(int sock, struct sockaddr_in *server, struct sockaddr_in
     unsigned char reply_buf[1024];
     fd_set rfds;
     struct timeval to = { STUN_TIMEOUT, 0 };
-#ifdef WIN32
-    int srclen;
-#else
-    socklen_t srclen;
-#endif
 
     int res = stun_send(sock, server, req);
     if(res < 0)
@@ -479,10 +466,10 @@ static int StunRequest2(int sock, struct sockaddr_in *server, struct sockaddr_in
     if (res <= 0)  /* timeout or error */
         return -11;
     struct sockaddr_in src = {};
-    srclen = sizeof(src);
-    /* XXX pass -1 in the size, because stun_handle_packet might
-   * write past the end of the buffer.
-   */
+    socklen_t srclen = sizeof(src);
+
+    // XXX pass -1 in the size, because stun_handle_packet might
+    // write past the end of the buffer.
     res = recvfrom(sock, (char *)reply_buf, sizeof(reply_buf) - 1,
                    0, (struct sockaddr *)&src, &srclen);
     if (res <= 0)