diff options
| author | Dusan Durech <dusan.d@centrum.sk> | 2008-11-15 16:08:21 +0100 |
|---|---|---|
| committer | Dusan Durech <dusan.d@centrum.sk> | 2008-11-15 16:08:21 +0100 |
| commit | 35084eaadf8b37f5c4a325f0d4b01767753ee9c3 (patch) | |
| tree | 8ca9a541783690eb6087a52faafa75e9a53d1521 /src/net/tcp.c | |
| parent | 98875c5a636f50fe89b9394b8193e86094ae14e0 (diff) | |
modification coding stile
Diffstat (limited to 'src/net/tcp.c')
| -rw-r--r-- | src/net/tcp.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/net/tcp.c b/src/net/tcp.c index ca11eb3..d8a40d8 100644 --- a/src/net/tcp.c +++ b/src/net/tcp.c @@ -55,6 +55,7 @@ sock_tcp_t *bindTcpSocket(char *address, int port, int proto) if (new->proto == PROTO_TCPv4) { new->sock = socket(AF_INET, SOCK_STREAM, 0); } + #ifdef SUPPORT_IPv6 if (new->proto == PROTO_TCPv6) { new->sock = socket(AF_INET6, SOCK_STREAM, 0); @@ -114,15 +115,13 @@ sock_tcp_t *getTcpNewClient(sock_tcp_t * p) if (new->proto == PROTO_TCPv4) { client_len = sizeof(new->sockAddr); - new->sock = accept(p->sock, (struct sockaddr *) &new->sockAddr, - (socklen_t *) & client_len); + new->sock = accept(p->sock, (struct sockaddr *) &new->sockAddr, (socklen_t *) & client_len); } #ifdef SUPPORT_IPv6 if (new->proto == PROTO_TCPv6) { client_len = sizeof(new->sockAddr6); - new->sock = accept(p->sock, (struct sockaddr *) &new->sockAddr6, - (socklen_t *) & client_len); + new->sock = accept(p->sock, (struct sockaddr *) &new->sockAddr6, (socklen_t *) & client_len); } #endif @@ -186,6 +185,7 @@ sock_tcp_t *connectTcpSocket(char *ip, int port, int proto) if (new->proto == PROTO_TCPv4) { new->sock = socket(AF_INET, SOCK_STREAM, 0); } + #ifdef SUPPORT_IPv6 if (new->proto == PROTO_TCPv6) { new->sock = socket(AF_INET6, SOCK_STREAM, 0); @@ -206,6 +206,7 @@ sock_tcp_t *connectTcpSocket(char *ip, int port, int proto) len = sizeof(new->sockAddr); ret = connect(new->sock, (struct sockaddr *) &new->sockAddr, len); } + #ifdef SUPPORT_IPv6 if (new->proto == PROTO_TCPv6) { new->sockAddr6.sin6_family = AF_INET6; @@ -235,10 +236,10 @@ int disableNagle(sock_tcp_t * p) int result; result = setsockopt(p->sock, /* socket affected */ - IPPROTO_TCP, /* set option at TCP level */ - TCP_NODELAY, /* name of option */ - (char *) &flag, /* the cast is historical cruft */ - sizeof(int)); /* length of option value */ + IPPROTO_TCP, /* set option at TCP level */ + TCP_NODELAY, /* name of option */ + (char *) &flag, /* the cast is historical cruft */ + sizeof(int)); /* length of option value */ #if 0 if (result < 0) { |