mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-17 00:36:02 +10:00
[강운덕] [PINPOINT-244]tcp l4 연결확인 기능을 무시 하는 기능에, 여러 ip를 설정가능하도록 수정.
git-svn-id: http://svn.bds.nhncorp.com/pe/pinpoint-rpc/trunk@3038 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -48,7 +48,7 @@ public class PinpointServerSocket extends SimpleChannelHandler {
|
||||
|
||||
private ServerMessageListener messageListener = SimpleLoggingServerMessageListener.LISTENER;
|
||||
private WriteFailFutureListener traceSendAckWriteFailFutureListener = new WriteFailFutureListener(logger, "TraceSendAckPacket send fail.", "TraceSendAckPacket send() success.");
|
||||
private InetAddress ignoreAddress;
|
||||
private InetAddress[] ignoreAddressList;
|
||||
|
||||
public PinpointServerSocket() {
|
||||
ServerBootstrap bootstrap = createBootStrap(1, WORKER_COUNT);
|
||||
@@ -58,8 +58,11 @@ public class PinpointServerSocket extends SimpleChannelHandler {
|
||||
this.pingTimer = TimerFactory.createHashedWheelTimer("PinpointServerSocket-PingTimer", 50, TimeUnit.MILLISECONDS, 512);
|
||||
}
|
||||
|
||||
public void setIgnoreAddress(InetAddress ignoreAddress) {
|
||||
this.ignoreAddress = ignoreAddress;
|
||||
public void setIgnoreAddressList(InetAddress[] ignoreAddressList) {
|
||||
if (ignoreAddressList == null) {
|
||||
throw new NullPointerException("ignoreAddressList must not be null");
|
||||
}
|
||||
this.ignoreAddressList = ignoreAddressList;
|
||||
}
|
||||
|
||||
private void addPipeline(ServerBootstrap bootstrap) {
|
||||
@@ -186,6 +189,7 @@ public class PinpointServerSocket extends SimpleChannelHandler {
|
||||
} else if (packet instanceof StreamClosePacket) {
|
||||
logger.debug("StreamDestroy {}, streamId:{}", channel, packet.getChannelId());
|
||||
ServerStreamChannel streamChannel = context.getStreamChannel(packet.getChannelId());
|
||||
// null이 나올수 있음.
|
||||
boolean close = streamChannel.close();
|
||||
if (close) {
|
||||
messageListener.handleStream(packet, streamChannel);
|
||||
@@ -253,14 +257,14 @@ public class PinpointServerSocket extends SimpleChannelHandler {
|
||||
if (check) {
|
||||
logger.warn("Unexpected Client channelClosed {}", channel);
|
||||
} else {
|
||||
logger.debug("Unexpected checkAddress channelClosed {}", channel);
|
||||
logger.debug("checkAddress, Client channelClosed channelClosed {}", channel);
|
||||
}
|
||||
}
|
||||
channelContext.closeAllStreamChannel();
|
||||
}
|
||||
|
||||
private boolean checkIgnoreAddress(Channel channel) {
|
||||
if (ignoreAddress == null) {
|
||||
if (ignoreAddressList == null) {
|
||||
return true;
|
||||
}
|
||||
final InetSocketAddress remoteAddress = (InetSocketAddress) channel.getRemoteAddress();
|
||||
@@ -268,8 +272,10 @@ public class PinpointServerSocket extends SimpleChannelHandler {
|
||||
return true;
|
||||
}
|
||||
InetAddress address = remoteAddress.getAddress();
|
||||
if (ignoreAddress.equals(address)) {
|
||||
return false;
|
||||
for (InetAddress ignore : ignoreAddressList) {
|
||||
if (ignore.equals(address)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user