What steps will reproduce the problem?
1. Use NetPeer.MessageReceivedEvent to wait for new messages.
2. Use Release compilation so shutdown debug messages are not sent.
3. Do not estabish any connections so no connection will be closed and
therefore generate messages
4. Start NetPeer (NetServer or NetClient in my case) and wait for the messages
in the separate thread.
5. Shutdown NetPeer.
What is the expected output? What do you see instead?
The message consumer thread still waits for the messages until waiting timout
is elapled.
WaitHandle.Close() doesn't seem to release the waiting threads. (It is called
in NetPeer.Internal.cs Line 214).
What version of the product are you using? On what operating system?
lidgren-network-gen3-2011-06-07.zip
WinXP SP3+/Win 7
Please provide any additional information below.
I use the following code in the consumer thread:
lidgrenServer.MessageReceivedEvent.WaitOne(RECEIVE_TIMOUT);
NetIncomingMessage message;
while ((message = lidgrenServer.ReadMessage()) != null)
{
...
}
For a while I added a signal before closing the AutoResetEvent so the fixed
code looks like that in NetPeer.Internal.cs Line 214
if (m_messageReceivedEvent != null)
{
m_messageReceivedEvent.Set();
m_messageReceivedEvent.Close();
m_messageReceivedEvent = null;
}
Original issue reported on code.google.com by oga...@servicerepairsolutions.com on 8 Jun 2011 at 7:37
Original issue reported on code.google.com by
oga...@servicerepairsolutions.com
on 8 Jun 2011 at 7:37