vapor-community / sockets

🔌 Non-blocking TCP socket layer, with event-driven server and client.
MIT License
575 stars 54 forks source link

Socks is unable to detect a closed connection in receive #91

Closed Joannis closed 7 years ago

Joannis commented 7 years ago

https://github.com/vapor/socks/blob/bd9af15409002dbc924b92f9220788c25c278d53/Sources/SocksCore/TCPSocket.swift#L45 checks for the received byte count to be greater than -1. However, it doesn't take into consideration that the byte count can be 0, which means that the connection has been closed.