by John Doty posted on 2003/08/17 |
|
A client using a SecureSocket can get itself into a deadlock quite easily if it does a synchronous send from the callback of an asynchronous receive.
That is if you do something like:
SecureSocket ss = ...;
void SetupReceive()
{
ss.BeginReceive(ReceiveCallback);
}
void ReceiveCallback(IAsyncResult result)
{
ss.Send(new byte[] {...});
}
then the Send() will deadlock and never complete. The reason for this is that the ReceiveCallback is called from SocketController.OnReceive (via ProcessDecryptedBytes) while holding the lock on the SocketController. Thus, when EndSend() tries to take the lock to complete the send, it cannot.
Is this going to be fixed soon?
|