Fix deadlock on user reconnect.

Also adds a space before chat messages.
This commit is contained in:
IntegratedQuantum 2024-12-07 21:47:53 +01:00
parent 0d56992c22
commit 8312253e77
2 changed files with 2 additions and 2 deletions

View File

@ -1685,9 +1685,9 @@ pub const Connection = struct { // MARK: Connection
const id = std.mem.readInt(u32, data[1..5], .big);
if(self.handShakeState.load(.monotonic) == Protocols.handShake.stepComplete and id == 0) { // Got a new "first" packet from client. So the client tries to reconnect, but we still think it's connected.
if(self.user) |user| {
user.reinitialize();
self.mutex.lock();
defer self.mutex.unlock();
user.reinitialize();
self.reinitialize();
} else {
std.log.err("Server reconnected?", .{});