Packet loss causes connect() to succeed even though the socket is not connected
Brought to you by:
lilyco
In core.cpp:709, if the server's handshake response is lost, the packet received might be a data packet.
In this case, CUDT::connect(const CPacket& response) returns -1, which is basically ignored by CUDT::connect(const sockaddr* serv_addr), and a success value is returned to the user.
When trying to recv() from the socket afterwards, an error is returned, saying "Connection does not exist".
I fixed this locally by having CUDT::connect(const CPacket& response) return 1 whenever a data packet arrived