Olivine-Labs / Alchemy-Websockets

An extremely efficient C# WebSocket server.
http://AlchemyWebsockets.net
Other
309 stars 105 forks source link

the bug fo call OnDisconnect() and send close #75

Open steeliter opened 11 years ago

steeliter commented 11 years ago

I found a bug ,when i disconnect websocket at client. the OnDisconnect() should not write in Context.Dispose(),because the .NET Garbage Collection(GC),the GC always call Method Dispose() when there's no reference to Context .so when client close the connection ,the server may call Dispose sevrial times.,and now the connction is null,there will be some exception. hope it is useful and fix the bug.

And in WebSocketHandler : case DataFrame.DataState.Closed: context.UserContext.Send(context.UserContext.DataFrame.CreateInstance(), false, true); break; the first param of Socket Send Method should have one or more item. here also throw a Exception

i use alchemy in vs2012..net4.5