lnobad / lidgren-network-gen3

Automatically exported from code.google.com/p/lidgren-network-gen3
0 stars 0 forks source link

Shutdown doesnt work properly when SimulatedMinimumLatency is set #111

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.In debug mode, I set netConfig.SimulatedMinimumLatency = 0.05f;
2.when exiting, I call netServer.Shutdown("Server shutting down");
3.then Thread.Sleep(400); - prevent killing of process

What is the expected output? What do you see instead?
Clients should recieve "Server shutting down" message.
Nothing is recieved, only timeout after some long time.

What version of the product are you using? On what operating system?
Latest (2012-02-15) download, WIN 7, XNA 4.0, VS 2010 (not express ... maybe 
profesional - not sure)

Please provide any additional information below.
When the project is set to Release (no MinimumLatency), all working OK.

Original issue reported on code.google.com by jak.bu...@gmail.com on 11 Mar 2012 at 10:16

GoogleCodeExporter commented 9 years ago
Unfortunately that's the way things work. Shutdown() must exit quickly, so any 
shutdown message will be a best-effort only. If the packets are lost en route, 
there's nothing to do about it.

Original comment by lidg...@gmail.com on 12 Mar 2012 at 7:59

GoogleCodeExporter commented 9 years ago
So may I pretend that on real network with real latency, the result will be 
same with only using Shutdown()?

Original comment by jak.bu...@gmail.com on 12 Mar 2012 at 10:17

GoogleCodeExporter commented 9 years ago
If the shutdown message is lost due to packetloss, it will not be resent - ie. 
the connection will time out. If ordering shutdown is very important, create 
your manual shutdown message and send it reliably; but you must not shut down 
the application until you have confirmation that the client has shut down and 
no more resends needs to be done.

Original comment by lidg...@gmail.com on 12 Mar 2012 at 10:27

GoogleCodeExporter commented 9 years ago
Ok, i can live without it. I was just supprised about theat if I set some 
relatively small latency (only latency no packet loss), that it doesnt arrive 
at all. When I was testing on WLAN (latency < 50ms), any shutdown sent arrived 
properly. Thats why I thought its some bug in simulating latency. Anyway thanks 
for clarification

Original comment by jak.bu...@gmail.com on 12 Mar 2012 at 10:36

GoogleCodeExporter commented 9 years ago
Ah... THAT is probably an issue (sim latency, not loss) - Shutdown will turn 
off netpeer heartbeat, which is needed to push out delayed packets. OTOH it 
will also shut down the socket, so we cannot even send the messages later. It 
would probably be best to push out all delayed packets when shutting down.

Original comment by lidg...@gmail.com on 12 Mar 2012 at 12:20

GoogleCodeExporter commented 9 years ago
Flushing delayed messages on NetPeer shutdown added in 294

Original comment by lidg...@gmail.com on 26 May 2012 at 9:08