Do You Hear It Calling?

I spent the weekend working on some bugs and problems with the connection routine. I updated my build of the protocol library and noticed a small bug preventing Parsek from connecting. I made Lee aware of the small problem and he promptly fixed. It took a while to realize that the bug was a result of the protocol library and the whole time I thought it was the client doing something wrong. After resolving that, I pushed on further by throwing in some logger messages in the protocol library to see where Parsek was get stuck. Right now it is narrowed down to a particular problem. During connect, the protocol library sends the Connect frame to the server. This part is being properly executed. The GameLayer::connect function, line 354, is executed and returns true after the frame is sent. The problem is afterwards, the GameLayer::ConnectCallback is not executed and the client hangs in a gsConnecting state. This problem points to the eventloop not properly executing the callback functions. I tried to debug the eventloop and peak into what was going on. My listenForSocketRead(TPSocket *socket) is the only function getting called and the file descriptor monitors, handled by the QSocketNotifier class, are not getting triggered. I peaked into what information was being read from the TPSocket and it seems the file descriptor is being read as 0. After asking Lee, it turns out this is not normal and could be the reason why the QSocketNotifier is not triggering (monitoring fd = 0) and therefore the callbacks are not being executed.

In order to help make this problem easier to test and debug, I created a stripped down client simply for connecting. The main components in action here are the parsekeventloop class and the core of the program is in the mainwindow.cpp file. Have a look and see if there is something you might think is wrong in the eventloop or in the connection routine in mainwindow.

Download TAR Package
Visit Code Postings

Leave a Reply