Closed AgentFire closed 8 years ago
I'll integrate; but not sure why WaitMessage would fire when there's no message, unless you're reading from many threads simultaneously (which is quite fine). Run in DEBUG to make sure there's no exception that's glossed over in RELEASE.
@lidgren The behaviour I observe takes place exactly in DEBUG mode. Never tried RELEASE tho.
However, I can describe what I do: the code runs at the server, and a client uses Connect
to establish connection, then at the server I do successefully read the ConnectionApproval
message, yet I ignore it, skipping any Deny
or Approve
method calls. That produces a Warning
message (as expected tho). Yet what is not expected is that after I ignore that incoming connection, next message read by ReadMessage()
is returned as null, while the AutoResetEvent is "set" (WaitOne returns true).
That happens again if you do all the same (ignore the incoming connection) in the same NetPeer without any restarts/resets.
Ok, not sure why that happens. However, altho unexpected; ReadMessage() should be assumed to sometimes return null - it just means there's no message to read.
Fixed an issue in the
WaitMessage(int)
whenMessageReceivedEvent
is signaled, yetReadMessage()
returns null.