Not thread safe

Dec 1, 2011 at 6:15 AM

I modified your code to support sending binary data over draft hybi10. I tested with 2 packets being sent back to back, one sent via SendResponseAsync(string) and the other with a SendResponse(byte[]) which i implemented at the protocol level. This starts a race condition with the new thread from the Async response that can intermittently fail.

The DraftHybi10Processor.cs sendMessage sends the packet with 2 seperate supersocket calls for the header and the data which can cause one thread to first send its header, then have another thread send its header before the first thread can send its data chunk.

Tried the same test without sendresponseAsync and the bug went away.

Dec 1, 2011 at 6:21 AM

Yes, I found the similar issue in other place, I'll try to fix this issue on these days.