Wednesday, May 3, 2017

Tale of socket->deletelater

One of my test servers was crashing with multiple connections. Digging in I found out that I have used same object for QTcpSocket and disconnect signal was not getting received before getting new connection.
So client should send disconnect before connecting on new connection. So digging in client code, I found nothing. Okay. Documentation... Found out there's close() function in unistd.h which can be used to close a socket connection.
Okay, made a call to that with socketfd, and voilla! Bug fixed! Server's safe.

But going to have to add handling for rogue clients. Adios.

No comments:

Post a Comment