From a3298d2b9e8174f39c8d11f6df8526f360f65592 Mon Sep 17 00:00:00 2001 From: sometwo Date: Fri, 26 Jul 2013 19:10:22 -0300 Subject: Fix some indenting --- core/network.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'core/network.c') diff --git a/core/network.c b/core/network.c index 6a4d0bce..549427bf 100644 --- a/core/network.c +++ b/core/network.c @@ -42,8 +42,6 @@ uint64_t current_time() time = 1000000UL*a.tv_sec + a.tv_usec; return time; #endif - - } /* return a random number @@ -67,7 +65,6 @@ int sendpacket(IP_Port ip_port, uint8_t * data, uint32_t length) { ADDR addr = {AF_INET, ip_port.port, ip_port.ip}; return sendto(sock,(char *) data, length, 0, (struct sockaddr *)&addr, sizeof(addr)); - } /* Function to receive data, ip and port of sender is put into ip_port @@ -92,7 +89,6 @@ int receivepacket(IP_Port * ip_port, uint8_t * data, uint32_t * length) ip_port->ip = addr.ip; ip_port->port = addr.port; return 0; - } /* initialize networking @@ -106,21 +102,18 @@ int init_networking(IP ip, uint16_t port) #ifdef WIN32 WSADATA wsaData; if(WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) - { return -1; - } - #else srandom((uint32_t)current_time()); #endif srand((uint32_t)current_time()); - + /* initialize our socket */ sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); /* Check for socket error */ #ifdef WIN32 - if (sock == INVALID_SOCKET) //MSDN recommends this + if (sock == INVALID_SOCKET) /* MSDN recommends this */ return -1; #else if (sock < 0) @@ -137,11 +130,10 @@ int init_networking(IP ip, uint16_t port) } if(setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char*)&n, sizeof(n)) == -1) - { return -1; - }*/ + */ - /*Enable broadcast on socket*/ + /* Enable broadcast on socket */ int broadcast = 1; setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char*)&broadcast, sizeof(broadcast)); @@ -188,11 +180,9 @@ int resolve_addr(char *address) int success = getaddrinfo(address, "7", &hints, &server); if(success != 0) - { return -1; - } int resolved = ((struct sockaddr_in*)server->ai_addr)->sin_addr.s_addr; freeaddrinfo(server); return resolved; -} \ No newline at end of file +} -- cgit v1.2.3