Issue #1881 - eliminate NPE in id generation against UnixSocketChannel

This commit is contained in:
Joakim Erdfelt 2017-10-10 12:09:52 -07:00
parent ce039eb4cb
commit d34f04c559
1 changed files with 3 additions and 5 deletions

View File

@ -114,6 +114,7 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
}
private static final Logger LOG = Log.getLogger(AbstractWebSocketConnection.class);
private static final AtomicLong ID_GEN = new AtomicLong(0);
/**
* Minimum size of a buffer is the determined to be what would be the maximum framing header size (not including payload)
@ -139,11 +140,8 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
public AbstractWebSocketConnection(EndPoint endp, Executor executor, Scheduler scheduler, WebSocketPolicy policy, ByteBufferPool bufferPool)
{
super(endp,executor);
this.id = String.format("%s:%d->%s:%d",
endp.getLocalAddress().getAddress().getHostAddress(),
endp.getLocalAddress().getPort(),
endp.getRemoteAddress().getAddress().getHostAddress(),
endp.getRemoteAddress().getPort());
this.id = Long.toString(ID_GEN.incrementAndGet());
this.policy = policy;
this.bufferPool = bufferPool;
this.generator = new Generator(policy,bufferPool);