private void doDisconnect(string logMessage) { if (this.state == ClientState.Disposing) { return; } this.state = ClientState.Disposing; StarryboundServer.logInfo("[" + playerData.client + "] " + logMessage); try { if (this.playerData.name != null) { Client target = StarryboundServer.getClient(this.playerData.name); if (target != null) { Users.SaveUser(this.playerData); StarryboundServer.removeClient(this); if (this.kickTargetTimestamp == 0) { StarryboundServer.sendGlobalMessage(this.playerData.name + " has left the server."); } } } } catch (Exception e) { StarryboundServer.logException("Failed to remove client from clients: " + e.ToString()); } try { this.sendServerPacket(Packet.ClientDisconnect, new byte[1]); } catch (Exception) { } try { this.cSocket.Close(); this.sSocket.Close(); } catch (Exception) { } try { this.ClientForwarder.Abort(); this.ServerForwarder.Abort(); } catch (Exception) { } }