Hi,
Recently I added a call to CwclServer::Close() in the function that is hooked to the event CwclServer::OnDisconnected. This worked as expected on the Microsoft stacks, however on the Toshiba stack it causes a crash. I require this as I do not want to listen for inbound connections after the the remote side has disconnected.
This crash happens because CloseToshiba() gets called twice, and the second time it deletes the now NULL m_pSerialClient (which got deleted on the first call).
in the CwclCustomServerConnection::Close(), the third line "Disconnect()" triggers the callback, which in turn calls Close(), after which Close() continues and calls CloseTosiba() on an already closed stack.
adding
if (m_ToshibaState == tssClosed)
return;
to the top of CloseToshiba() fixed the problem.
Is calling Close() inside the disconnect event handler OK? and if not is there a another way to close (stop the server listening) when the client disconnects.
Please note that I will be away for the next few days, so may be slow to reply if you need more information about this issue
Regards
David