mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-20 02:05:58 +10:00
[#1195] Improve to ignore UDP packet
This commit is contained in:
@@ -271,13 +271,6 @@ public class TCPReceiver {
|
||||
SocketAddress remoteAddress = pinpointSocket.getRemoteAddress();
|
||||
try {
|
||||
TBase<?, ?> tBase = SerializationUtils.deserialize(bytes, deserializerFactory);
|
||||
if (tBase instanceof L4Packet) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
L4Packet packet = (L4Packet) tBase;
|
||||
logger.debug("tcp l4 packet {}", packet.getHeader());
|
||||
}
|
||||
return;
|
||||
}
|
||||
TBase result = dispatchHandler.dispatchRequestMessage(tBase);
|
||||
if (result != null) {
|
||||
byte[] resultBytes = SerializationUtils.serialize(result, serializerFactory);
|
||||
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 NAVER Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.collector.receiver.udp;
|
||||
|
||||
import com.navercorp.pinpoint.thrift.io.L4Packet;
|
||||
import org.apache.thrift.TBase;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class L4PacketFilter<T> implements TBaseFilter<T> {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Override
|
||||
public boolean filter(TBase<?, ?> tBase, T remoteAddress) {
|
||||
if (tBase instanceof L4Packet) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
L4Packet l4Packet = (L4Packet) tBase;
|
||||
logger.debug("udp l4 packet {} {}", l4Packet.getHeader(), remoteAddress);
|
||||
}
|
||||
return BREAK;
|
||||
}
|
||||
return CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -212,13 +212,11 @@
|
||||
<bean id="tBaseFilterChain" class="com.navercorp.pinpoint.collector.receiver.udp.TBaseFilterChain">
|
||||
<constructor-arg>
|
||||
<list>
|
||||
<ref bean="l4PacketFilter"/>
|
||||
<ref bean="networkAvailabilityCheckPacketFilter"/>
|
||||
</list>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="l4PacketFilter" class="com.navercorp.pinpoint.collector.receiver.udp.L4PacketFilter"/>
|
||||
<bean id="networkAvailabilityCheckPacketFilter" class="com.navercorp.pinpoint.collector.receiver.udp.NetworkAvailabilityCheckPacketFilter"/>
|
||||
|
||||
|
||||
|
||||
-3
@@ -79,9 +79,6 @@ public class ChunkHeaderTBaseDeserializer {
|
||||
}
|
||||
|
||||
final int validate = validate(header);
|
||||
if (validate == HeaderUtils.PASS_L4) {
|
||||
return new L4Packet(header);
|
||||
}
|
||||
|
||||
TBase<?, ?> base = locator.tBaseLookup(header.getType());
|
||||
base.read(protocol);
|
||||
|
||||
@@ -65,9 +65,6 @@ public class HeaderTBaseDeserializer {
|
||||
base.read(protocol);
|
||||
return base;
|
||||
}
|
||||
if (validate == HeaderUtils.PASS_L4) {
|
||||
return new L4Packet(header);
|
||||
}
|
||||
throw new IllegalStateException("invalid validate " + validate);
|
||||
} finally {
|
||||
trans.clear();
|
||||
@@ -87,8 +84,6 @@ public class HeaderTBaseDeserializer {
|
||||
TBase<?, ?> base = locator.tBaseLookup(header.getType());
|
||||
base.read(protocol);
|
||||
tBaseList.add(base);
|
||||
} else if (validate == HeaderUtils.PASS_L4) {
|
||||
tBaseList.add(new L4Packet(header));
|
||||
} else {
|
||||
throw new IllegalStateException("invalid validate " + validate);
|
||||
}
|
||||
|
||||
@@ -21,8 +21,6 @@ package com.navercorp.pinpoint.thrift.io;
|
||||
*/
|
||||
final class HeaderUtils {
|
||||
public static final int OK = Header.SIGNATURE;
|
||||
// TODO Maybe PASS_L4 should be a modifiable variable
|
||||
public static final int PASS_L4 = 85; // Udp
|
||||
public static final int FAIL = 0;
|
||||
|
||||
private HeaderUtils() {
|
||||
@@ -31,9 +29,7 @@ final class HeaderUtils {
|
||||
public static int validateSignature(byte signature) {
|
||||
if (Header.SIGNATURE == signature) {
|
||||
return OK;
|
||||
} else if (PASS_L4 == signature) {
|
||||
return PASS_L4;
|
||||
}
|
||||
}
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 NAVER Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.thrift.io;
|
||||
|
||||
import org.apache.thrift.TBase;
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.TFieldIdEnum;
|
||||
import org.apache.thrift.protocol.TProtocol;
|
||||
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class L4Packet implements org.apache.thrift.TBase<L4Packet, org.apache.thrift.TFieldIdEnum>, java.io.Serializable, Cloneable, Comparable<L4Packet> {
|
||||
|
||||
private final transient Header header;
|
||||
|
||||
public L4Packet(Header header) {
|
||||
this.header = header;
|
||||
}
|
||||
|
||||
public Header getHeader() {
|
||||
return header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(TProtocol tProtocol) throws TException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(TProtocol tProtocol) throws TException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TFieldIdEnum fieldForId(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSet(TFieldIdEnum tFieldIdEnum) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getFieldValue(TFieldIdEnum tFieldIdEnum) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFieldValue(TFieldIdEnum tFieldIdEnum, Object o) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TBase deepCopy() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(L4Packet o) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user