Adds the remote address and ufrag to a log message. (#190)

* Adds the remote address and ufrag to a log message.
This commit is contained in:
bgrozev 2020-02-26 10:28:55 -06:00 committed by GitHub
parent 7989977e1e
commit fe30fe8a31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -391,12 +391,13 @@ public abstract class AbstractUdpListener
* *
* @param remoteAddress the remote address with which to associate the new * @param remoteAddress the remote address with which to associate the new
* socket instance. * socket instance.
* @param ufrag The username fragment associated with the socket.
* @return the created socket instance. * @return the created socket instance.
*/ */
protected MySocket addSocket(InetSocketAddress remoteAddress) protected MySocket addSocket(InetSocketAddress remoteAddress, String ufrag)
throws SocketException throws SocketException
{ {
MySocket newSocket = new MySocket(remoteAddress); MySocket newSocket = new MySocket(remoteAddress, ufrag);
sockets.put(remoteAddress, newSocket); sockets.put(remoteAddress, newSocket);
return newSocket; return newSocket;
} }
@ -440,6 +441,8 @@ public abstract class AbstractUdpListener
*/ */
private boolean closed = false; private boolean closed = false;
private final String ufrag;
/** /**
* Initializes a new <tt>MySocket</tt> instance with the given * Initializes a new <tt>MySocket</tt> instance with the given
* remote address. * remote address.
@ -447,12 +450,13 @@ public abstract class AbstractUdpListener
* new instance. * new instance.
* @throws SocketException * @throws SocketException
*/ */
MySocket(InetSocketAddress remoteAddress) MySocket(InetSocketAddress remoteAddress, String ufrag)
throws SocketException throws SocketException
{ {
// unbound // unbound
super((SocketAddress)null); super((SocketAddress)null);
this.ufrag = ufrag;
this.remoteAddress = remoteAddress; this.remoteAddress = remoteAddress;
if (logger.isLoggable(Level.FINEST)) if (logger.isLoggable(Level.FINEST))
{ {
@ -476,7 +480,9 @@ public abstract class AbstractUdpListener
// receivers can notice the loss earlier. // receivers can notice the loss earlier.
if (queue.size() == QUEUE_SIZE) if (queue.size() == QUEUE_SIZE)
{ {
logger.info("Dropping a packet because the queue is full."); logger.info(
"Dropping a packet because the queue is full. Remote address = "
+ remoteAddress + " ufrag=" + ufrag);
if (queueStatistics != null) if (queueStatistics != null)
{ {
queueStatistics.remove(System.currentTimeMillis()); queueStatistics.remove(System.currentTimeMillis());

View File

@ -145,7 +145,7 @@ public class SinglePortUdpHarvester
// 1. Create a socket for this remote address // 1. Create a socket for this remote address
// 2. Set-up de-multiplexing for future datagrams // 2. Set-up de-multiplexing for future datagrams
// with this address to this socket. // with this address to this socket.
MySocket newSocket = addSocket(remoteAddress); MySocket newSocket = addSocket(remoteAddress, ufrag);
// 3. Let the candidate and its STUN stack no about the // 3. Let the candidate and its STUN stack no about the
// new socket. // new socket.