diff --git a/Changelog b/Changelog index bb4831f..6ce3b9d 100644 --- a/Changelog +++ b/Changelog @@ -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 diff --git a/tcp.cc b/tcp.cc index 1548564..9578eb8 100644 --- a/tcp.cc +++ b/tcp.cc @@ -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;