diff options
Diffstat (limited to 'src/Net/ServerConnection.cpp')
-rw-r--r-- | src/Net/ServerConnection.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Net/ServerConnection.cpp b/src/Net/ServerConnection.cpp index 1e0959d..7c9f9b8 100644 --- a/src/Net/ServerConnection.cpp +++ b/src/Net/ServerConnection.cpp @@ -53,7 +53,10 @@ void ServerConnection::listen(const IPAddress &address) throw(ConnectionExceptio throw ConnectionException("listen()", std::strerror(errno)); } - sock = accept(listen_sock, NULL, NULL); + struct sockaddr_in sa; + socklen_t addrlen = sizeof(sa); + + sock = accept(listen_sock, reinterpret_cast<struct sockaddr*>(&sa), &addrlen); if(sock < 0) { close(listen_sock); delete peer; @@ -63,6 +66,8 @@ void ServerConnection::listen(const IPAddress &address) throw(ConnectionExceptio close(listen_sock); + *peer = IPAddress(address); + connected = true; gnutls_init(&session, GNUTLS_SERVER); |