diff options
Diffstat (limited to 'core/network.c')
-rw-r--r-- | core/network.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/core/network.c b/core/network.c index 549427bf..160db880 100644 --- a/core/network.c +++ b/core/network.c | |||
@@ -79,13 +79,10 @@ int receivepacket(IP_Port * ip_port, uint8_t * data, uint32_t * length) | |||
79 | #else | 79 | #else |
80 | uint32_t addrlen = sizeof(addr); | 80 | uint32_t addrlen = sizeof(addr); |
81 | #endif | 81 | #endif |
82 | (*(int32_t *)length) = recvfrom(sock,(char *) data, MAX_UDP_PACKET_SIZE, 0, (struct sockaddr *)&addr, &addrlen); | 82 | (*(int32_t*)length) = recvfrom(sock,(char*) data, MAX_UDP_PACKET_SIZE, 0, (struct sockaddr*)&addr, &addrlen); |
83 | if(*(int32_t *)length <= 0) | 83 | if (*(int32_t*)length <= 0) |
84 | { | 84 | return -1; /* nothing received or empty packet */ |
85 | /* nothing received | 85 | |
86 | or empty packet */ | ||
87 | return -1; | ||
88 | } | ||
89 | ip_port->ip = addr.ip; | 86 | ip_port->ip = addr.ip; |
90 | ip_port->port = addr.port; | 87 | ip_port->port = addr.port; |
91 | return 0; | 88 | return 0; |
@@ -101,7 +98,7 @@ int init_networking(IP ip, uint16_t port) | |||
101 | { | 98 | { |
102 | #ifdef WIN32 | 99 | #ifdef WIN32 |
103 | WSADATA wsaData; | 100 | WSADATA wsaData; |
104 | if(WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) | 101 | if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) |
105 | return -1; | 102 | return -1; |
106 | #else | 103 | #else |
107 | srandom((uint32_t)current_time()); | 104 | srandom((uint32_t)current_time()); |