From 62c1164da29ba10fc0db71e270e0b6315249c25d Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 2 Oct 2008 17:25:37 +0000 Subject: [PATCH] Two things: we shouldn't reference _conn outside the two synchronized methods that read and write it, and we need to cope if a client manages to go away before we can send it its bootstrap response. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5412 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/presents/server/PresentsClient.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/java/com/threerings/presents/server/PresentsClient.java b/src/java/com/threerings/presents/server/PresentsClient.java index 9520aa9b9..5b4ebce8f 100644 --- a/src/java/com/threerings/presents/server/PresentsClient.java +++ b/src/java/com/threerings/presents/server/PresentsClient.java @@ -383,7 +383,7 @@ public class PresentsClient // first time through we end our session, subsequently _throttle is null and we just drop // any messages that come in until we've fully shutdown if (_throttle == null) { -// log.info("Dropping message from force-quit client [conn=" + _conn + +// log.info("Dropping message from force-quit client [conn=" + getConnection() + // ", msg=" + message + "]."); return; @@ -678,7 +678,13 @@ public class PresentsClient protected void populateBootstrapData (BootstrapData data) { // give them the connection id - data.connectionId = _conn.getConnectionId(); + Connection conn = getConnection(); + if (conn != null) { + data.connectionId = conn.getConnectionId(); + } else { + log.warning("Client connection disappeared before we could send bootstrap response."); + return; // stop here as we're just going to throw away this bootstrap + } // and the client object id data.clientOid = _clobj.getOid(); @@ -830,7 +836,7 @@ public class PresentsClient protected void toString (StringBuilder buf) { buf.append("username=").append(_username); - buf.append(", conn=").append(_conn); + buf.append(", conn=").append(getConnection()); buf.append(", who=").append(_username); buf.append(", in=").append(_messagesIn); buf.append(", out=").append(_messagesOut);