April 21, 2009

Bug fix for the free server framework code

A user of my free server framework code has reported an error and supplied a fix.

The problem is that he's been having connections closing and returning ERROR_CONNECTION_ABORTED and the free code doesn't handle this situation very well and this was causing his I/O threads to terminate and leaving him with an unresponsive server. Interestingly I've never had this problem reported before and haven't been able to duplicate the issue but I thought it would be useful to publish the fix in case anyone else comes across the problem.

His suggested fix is to change the code in CSocketServer::WorkerThread::Run() from

   else if (e.GetError() != WSA_OPERATION_ABORTED)
{
throw;
}

to
   else if (e.GetError() != WSA_OPERATION_ABORTED &&
e.GetError() != ERROR_CONNECTION_ABORTED)
{
throw;
}

Which should do the job.

Note that the licensed code does not have this problem as it deals with connection errors in a much more robust and inclusive manner.

Thanks to Matthias Baur for sharing the solution with us.


Share this entry: Email it! | bookmark it! | digg it! | reddit!

Posted by Len at April 21, 2009 08:42 AM | Comments (1) | Categories : Socket Servers
Comments

Matthias Baur was right. Besides, ERROR_SEM_TIMEOUT returned sometimes.

Posted by: at July 31, 2009 07:07 AM
Post a comment









Remember personal info?




Enter this code in the box below to prove that you're not some kind of automated spam robot...