Related issue: NETTY-180 Channel.getRemoteAddress() can return null for a received MessageEvent when ExecutionHandler is in the pipeline.
* AbstractChannel.toString() does not use isConnected() or isBound() because it can lead to inconsistent string representation when ExecutionHandler is in the pipeline.
This commit is contained in:
parent
27ef64f549
commit
8448188706
@ -257,20 +257,22 @@ public abstract class AbstractChannel implements Channel {
|
|||||||
buf.append("[id: 0x");
|
buf.append("[id: 0x");
|
||||||
buf.append(getIdString());
|
buf.append(getIdString());
|
||||||
|
|
||||||
if (connected) {
|
SocketAddress localAddress = getLocalAddress();
|
||||||
|
SocketAddress remoteAddress = getRemoteAddress();
|
||||||
|
if (remoteAddress != null) {
|
||||||
buf.append(", ");
|
buf.append(", ");
|
||||||
if (getParent() == null) {
|
if (getParent() == null) {
|
||||||
buf.append(getLocalAddress());
|
buf.append(localAddress);
|
||||||
buf.append(" => ");
|
buf.append(" => ");
|
||||||
buf.append(getRemoteAddress());
|
buf.append(remoteAddress);
|
||||||
} else {
|
} else {
|
||||||
buf.append(getRemoteAddress());
|
buf.append(remoteAddress);
|
||||||
buf.append(" => ");
|
buf.append(" => ");
|
||||||
buf.append(getLocalAddress());
|
buf.append(localAddress);
|
||||||
}
|
}
|
||||||
} else if (isBound()) {
|
} else if (localAddress != null) {
|
||||||
buf.append(", ");
|
buf.append(", ");
|
||||||
buf.append(getLocalAddress());
|
buf.append(localAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.append(']');
|
buf.append(']');
|
||||||
|
Loading…
Reference in New Issue
Block a user