Switch to new samskivert logging API.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5134 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -27,11 +27,12 @@ import java.nio.channels.SocketChannel;
|
||||
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
import com.threerings.presents.net.AuthRequest;
|
||||
import com.threerings.presents.net.AuthResponse;
|
||||
import com.threerings.presents.net.UpstreamMessage;
|
||||
|
||||
import static com.threerings.presents.Log.log;
|
||||
|
||||
/**
|
||||
* The authing connection manages the client connection until
|
||||
* authentication has completed (for better or for worse).
|
||||
@@ -66,7 +67,7 @@ public class AuthingConnection extends Connection
|
||||
_cmgr.getAuthenticator().authenticateConnection(this);
|
||||
|
||||
} catch (ClassCastException cce) {
|
||||
Log.warning("Received non-authreq message during " +
|
||||
log.warning("Received non-authreq message during " +
|
||||
"authentication process [conn=" + this +
|
||||
", msg=" + msg + "].");
|
||||
}
|
||||
|
||||
@@ -44,12 +44,13 @@ import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.UnreliableObjectInputStream;
|
||||
import com.threerings.io.UnreliableObjectOutputStream;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
import com.threerings.presents.net.DownstreamMessage;
|
||||
import com.threerings.presents.net.PingRequest;
|
||||
import com.threerings.presents.net.UpstreamMessage;
|
||||
import com.threerings.presents.util.DatagramSequencer;
|
||||
|
||||
import static com.threerings.presents.Log.log;
|
||||
|
||||
/**
|
||||
* The base connection class implements the net event handler interface and processes raw incoming
|
||||
* network data into a stream of parsed <code>UpstreamMessage</code> objects. It also provides the
|
||||
@@ -166,7 +167,7 @@ public abstract class Connection implements NetEventHandler
|
||||
{
|
||||
// we shouldn't be closed twice
|
||||
if (isClosed()) {
|
||||
Log.warning("Attempted to re-close connection " + this + ".");
|
||||
log.warning("Attempted to re-close connection " + this + ".");
|
||||
Thread.dumpStack();
|
||||
return;
|
||||
}
|
||||
@@ -186,7 +187,7 @@ public abstract class Connection implements NetEventHandler
|
||||
{
|
||||
// if we're already closed, then something is seriously funny
|
||||
if (isClosed()) {
|
||||
Log.warning("Failure reported on closed connection " + this + ".");
|
||||
log.warning("Failure reported on closed connection " + this + ".");
|
||||
Thread.dumpStack();
|
||||
return;
|
||||
}
|
||||
@@ -264,11 +265,11 @@ public abstract class Connection implements NetEventHandler
|
||||
return;
|
||||
}
|
||||
|
||||
Log.debug("Closing channel " + this + ".");
|
||||
log.debug("Closing channel " + this + ".");
|
||||
try {
|
||||
_channel.close();
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Error closing connection [conn=" + this + ", error=" + ioe + "].");
|
||||
log.warning("Error closing connection [conn=" + this + ", error=" + ioe + "].");
|
||||
}
|
||||
|
||||
// clear out our references to prevent repeat closings
|
||||
@@ -314,7 +315,7 @@ public abstract class Connection implements NetEventHandler
|
||||
close();
|
||||
|
||||
} catch (ClassNotFoundException cnfe) {
|
||||
Log.warning("Error reading message from socket [channel=" +
|
||||
log.warning("Error reading message from socket [channel=" +
|
||||
StringUtil.safeToString(_channel) + ", error=" + cnfe + "].");
|
||||
// deal with the failure
|
||||
String errmsg = "Unable to decode incoming message.";
|
||||
@@ -324,7 +325,7 @@ public abstract class Connection implements NetEventHandler
|
||||
// don't log a warning for the ever-popular "the client dropped the connection" failure
|
||||
String msg = ioe.getMessage();
|
||||
if (msg == null || msg.indexOf("reset by peer") == -1) {
|
||||
Log.warning("Error reading message from socket [channel=" +
|
||||
log.warning("Error reading message from socket [channel=" +
|
||||
StringUtil.safeToString(_channel) + ", error=" + ioe + "].");
|
||||
}
|
||||
// deal with the failure
|
||||
@@ -344,7 +345,7 @@ public abstract class Connection implements NetEventHandler
|
||||
try {
|
||||
_digest = MessageDigest.getInstance("MD5");
|
||||
} catch (NoSuchAlgorithmException nsae) {
|
||||
Log.warning("Missing MD5 algorithm.");
|
||||
log.warning("Missing MD5 algorithm.");
|
||||
return;
|
||||
}
|
||||
ByteBufferInputStream bin = new ByteBufferInputStream(buf);
|
||||
@@ -360,7 +361,7 @@ public abstract class Connection implements NetEventHandler
|
||||
buf.position(4);
|
||||
for (int ii = 0; ii < 8; ii++) {
|
||||
if (hash[ii] != buf.get()) {
|
||||
Log.warning("Datagram failed hash check [connectionId=" + _connectionId +
|
||||
log.warning("Datagram failed hash check [connectionId=" + _connectionId +
|
||||
", source=" + source + "].");
|
||||
return;
|
||||
}
|
||||
@@ -379,10 +380,10 @@ public abstract class Connection implements NetEventHandler
|
||||
_handler.handleMessage(msg);
|
||||
|
||||
} catch (ClassNotFoundException cnfe) {
|
||||
Log.warning("Error reading datagram [error=" + cnfe + "].");
|
||||
log.warning("Error reading datagram [error=" + cnfe + "].");
|
||||
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Error reading datagram [error=" + ioe + "].");
|
||||
log.warning("Error reading datagram [error=" + ioe + "].");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,7 +397,7 @@ public abstract class Connection implements NetEventHandler
|
||||
if (isClosed()) {
|
||||
return true;
|
||||
}
|
||||
Log.info("Disconnecting non-communicative client [conn=" + this +
|
||||
log.info("Disconnecting non-communicative client [conn=" + this +
|
||||
", idle=" + idleMillis + "ms].");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.samskivert.util.*;
|
||||
|
||||
@@ -286,7 +285,7 @@ public class ConnectionManager extends LoopingThread
|
||||
log.info("Server listening on " + isa + ".");
|
||||
|
||||
} catch (IOException ioe) {
|
||||
log.log(Level.WARNING, "Failure listening to socket on port '" +
|
||||
log.warning("Failure listening to socket on port '" +
|
||||
_ports[ii] + "'.", ioe);
|
||||
_failure = ioe;
|
||||
}
|
||||
@@ -339,7 +338,7 @@ public class ConnectionManager extends LoopingThread
|
||||
log.info("Server accepting datagrams on " + isa + ".");
|
||||
|
||||
} catch (IOException ioe) {
|
||||
log.log(Level.WARNING, "Failure opening datagram channel on port '" +
|
||||
log.warning("Failure opening datagram channel on port '" +
|
||||
port + "'.", ioe);
|
||||
}
|
||||
}
|
||||
@@ -459,14 +458,14 @@ public class ConnectionManager extends LoopingThread
|
||||
conn.getAuthRequest(), conn.getAuthResponse());
|
||||
|
||||
} catch (IOException ioe) {
|
||||
log.log(Level.WARNING, "Failure upgrading authing connection to running.", ioe);
|
||||
log.warning("Failure upgrading authing connection to running.", ioe);
|
||||
}
|
||||
}
|
||||
|
||||
Set<SelectionKey> ready = null;
|
||||
try {
|
||||
// check for incoming network events
|
||||
// log.fine("Selecting from " + StringUtil.toString(_selector.keys()) + " (" +
|
||||
// log.debug("Selecting from " + StringUtil.toString(_selector.keys()) + " (" +
|
||||
// SELECT_LOOP_TIME + ").");
|
||||
int ecount = _selector.select(SELECT_LOOP_TIME);
|
||||
ready = _selector.selectedKeys();
|
||||
@@ -482,7 +481,7 @@ public class ConnectionManager extends LoopingThread
|
||||
} catch (IOException ioe) {
|
||||
if ("Invalid argument".equals(ioe.getMessage())) {
|
||||
// what is this, anyway?
|
||||
log.log(Level.WARNING, "Failure select()ing.", ioe);
|
||||
log.warning("Failure select()ing.", ioe);
|
||||
} else {
|
||||
log.warning("Failure select()ing [ioe=" + ioe + "].");
|
||||
}
|
||||
@@ -492,7 +491,7 @@ public class ConnectionManager extends LoopingThread
|
||||
// this block of code deals with a bug in the _selector that we observed on 2005-05-02,
|
||||
// instead of looping indefinitely after things go pear-shaped, shut us down in an
|
||||
// orderly fashion
|
||||
log.log(Level.WARNING, "Failure select()ing.", re);
|
||||
log.warning("Failure select()ing.", re);
|
||||
if (_runtimeExceptionCount++ >= 20) {
|
||||
log.warning("Too many errors, bailing.");
|
||||
shutdown();
|
||||
@@ -532,7 +531,7 @@ public class ConnectionManager extends LoopingThread
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, "Error processing network data: " + handler + ".", e);
|
||||
log.warning("Error processing network data: " + handler + ".", e);
|
||||
|
||||
// if you freak out here, you go straight in the can
|
||||
if (handler != null && handler instanceof Connection) {
|
||||
@@ -681,7 +680,7 @@ public class ConnectionManager extends LoopingThread
|
||||
try {
|
||||
return _datagramChannel.send(_databuf, target) > 0;
|
||||
} catch (IOException ioe) {
|
||||
log.log(Level.WARNING, "Failed to send datagram.", ioe);
|
||||
log.warning("Failed to send datagram.", ioe);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -699,7 +698,7 @@ public class ConnectionManager extends LoopingThread
|
||||
protected void handleIterateFailure (Exception e)
|
||||
{
|
||||
// log the exception
|
||||
log.log(Level.WARNING, "ConnectionManager.iterate() uncaught exception.", e);
|
||||
log.warning("ConnectionManager.iterate() uncaught exception.", e);
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
@@ -712,7 +711,7 @@ public class ConnectionManager extends LoopingThread
|
||||
try {
|
||||
_ssocket.socket().close();
|
||||
} catch (IOException ioe) {
|
||||
log.log(Level.WARNING, "Failed to close listening socket.", ioe);
|
||||
log.warning("Failed to close listening socket.", ioe);
|
||||
}
|
||||
|
||||
// and the datagram socket, if any
|
||||
@@ -752,7 +751,7 @@ public class ConnectionManager extends LoopingThread
|
||||
return;
|
||||
}
|
||||
|
||||
// log.fine("Accepted connection " + channel + ".");
|
||||
// log.debug("Accepted connection " + channel + ".");
|
||||
|
||||
// create a new authing connection object to manage the authentication of this client
|
||||
// connection and register it with our selection set
|
||||
@@ -767,7 +766,7 @@ public class ConnectionManager extends LoopingThread
|
||||
|
||||
} catch (IOException ioe) {
|
||||
// no need to complain this happens in the normal course of events
|
||||
// log.log(Level.WARNING, "Failure accepting new connection.", ioe);
|
||||
// log.warning("Failure accepting new connection.", ioe);
|
||||
}
|
||||
|
||||
// make sure we don't leak a socket if something went awry
|
||||
@@ -792,7 +791,7 @@ public class ConnectionManager extends LoopingThread
|
||||
try {
|
||||
source = (InetSocketAddress)listener.receive(_databuf);
|
||||
} catch (IOException ioe) {
|
||||
log.log(Level.WARNING, "Failure receiving datagram.", ioe);
|
||||
log.warning("Failure receiving datagram.", ioe);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -873,7 +872,7 @@ public class ConnectionManager extends LoopingThread
|
||||
_outq.append(new Tuple<Connection,byte[]>(conn, data));
|
||||
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, "Failure flattening message [conn=" + conn +
|
||||
log.warning("Failure flattening message [conn=" + conn +
|
||||
", msg=" + msg + "].", e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user