Open simbleau opened 5 days ago
Looks like timing issue, the server fully terminates the connection before it can gracefully close it
Looks like timing issue, the server fully terminates the connection before it can gracefully close it
I don't understand your feedback.
Do you mean I have to disconnect all clients before stopping?
Do you mean OnEnter(State) is not the right time?
Looks like timing issue, the server fully terminates the connection before it can gracefully close it
I don't understand your feedback.
Do you mean I have to disconnect all clients before stopping?
Do you mean OnEnter(State) is not the right time?
Ah no, i just thought this probably is a fault in lightyears disconnect logic where if you call disconnect() it just terminates the client connecting including the sender/receiver channel for packets before its able to send the disconnect packet, @cBournhonesque probably knows more about what might be happening here
Actually on second thought server stop very likely means automatically disconnect all clients so you probably dont need to disconnect them manually
Actually on second thought server stop very likely means automatically disconnect all clients so you probably dont need to disconnect them manually
It's ServerConnections.stop
which is documented as just flipping is_listening
to false
Looks like timing issue, the server fully terminates the connection before it can gracefully close it
I don't understand your feedback. Do you mean I have to disconnect all clients before stopping? Do you mean OnEnter(State) is not the right time?
Ah no, i just thought this probably is a fault in lightyears disconnect logic where if you call disconnect() it just terminates the client connecting including the sender/receiver channel for packets before its able to send the disconnect packet, @cBournhonesque probably knows more about what might be happening here
This would make sense. Hoping Charles can chime in.
I think calling ServerConnections.stop()
would indeed work; it calls stop()
for each of the NetServer, which in turn send disconnecting messages to each of the client.
I wouldn't worry too much about the error messages (even though it would be great if they were fixed).
For example to make sure that the disconnection is received correctly I send 10 disconnect packages in a row. It's possible that the first one is received very quickly and the connection is somehow stopped, and then when the others are received you just get
server failed to send disconnect packet: unable to send message to client: channel closed
@cBournhonesque maybe generally it makes sense to have this as a warn instead of an error. In the specific case of sending disconnect packets after close / termination its probably not needed at all though.
I've wired up the server so that Ctrl+C will trigger a graceful shutdown, which means:
That plugin looks like this:
My output is strange, am I doing this wrong?