fixed TCP::Accept, lenght os sockaddr was not passed right

origin
steffen 7 years ago
parent 37be3de810
commit 228ff862b2

@ -1,3 +1,6 @@
2019-02-21:
- fixed: TCP::Accept needed to set up the lenght of the sockaddr structure
2019-02-03:
- fixed: if connection could not established we need to clear sock to -1
- fixed: setsockopt SO_REUSE was not right option was not setup properly

@ -96,7 +96,7 @@ TCP* TCP::Accept() {
struct timeval tv;
int retval, newsock, err, i;
struct sockaddr_storage cli_addr;
unsigned int cli_len;
unsigned int cli_len = sizeof(cli_addr);
char host[NET_BUFFERSIZE];
char port[NET_BUFFERSIZE];
TCP *tcp = NULL;
@ -119,7 +119,6 @@ TCP* TCP::Accept() {
else if (retval) {
newsock = accept (sock, (struct sockaddr *) &cli_addr, &cli_len);
if (newsock < 0) return NULL;
tcp = new TCP();
tcp->SetSocket(newsock, &cli_addr, cli_len);
return tcp;

Loading…
Cancel
Save