mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 11:17:05 -04:00
Add a delay before after sending the disconnect signal on windows localhost.
fixes #1322
This commit is contained in:
parent
de3b862f1e
commit
6fc7e604e7
@ -2079,6 +2079,9 @@ pub const Connection = struct { // MARK: Connection
|
||||
pub fn disconnect(self: *Connection) void {
|
||||
self.manager.send(&.{@intFromEnum(ChannelId.disconnect)}, self.remoteAddress, null);
|
||||
self.connectionState.store(.disconnectDesired, .unordered);
|
||||
if(builtin.os.tag == .windows and !self.isServerSide() and main.server.world != null) {
|
||||
std.time.sleep(10000000); // Windows is too eager to close the socket, without waiting here we get a ConnectionResetByPeer on the other side.
|
||||
}
|
||||
self.manager.removeConnection(self);
|
||||
if(self.user) |user| {
|
||||
main.server.disconnect(user);
|
||||
|
Loading…
x
Reference in New Issue
Block a user