Merge pull request #2390 from jzdayz/develop

delete duplicate code and fix log error
This commit is contained in:
liaochuntao 2020-03-01 16:06:26 +08:00 committed by GitHub
commit 5319897ca2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -317,8 +317,6 @@ public class PushService implements ApplicationContextAware, ApplicationListener
try {
packet = new DatagramPacket(dataBytes, dataBytes.length, client.socketAddr);
Receiver.AckEntry ackEntry = new Receiver.AckEntry(key, packet);
ackEntry.data = data;
// we must store the key be fore send, otherwise there will be a chance the
// ack returns before we put in
ackEntry.data = data;
@ -649,7 +647,7 @@ public class PushService implements ApplicationContextAware, ApplicationListener
try {
udpSocket.receive(packet);
String json = new String(packet.getData(), 0, packet.getLength(), Charset.forName("UTF-8")).trim();
String json = new String(packet.getData(), 0, packet.getLength(), StandardCharsets.UTF_8).trim();
AckPacket ackPacket = JSON.parseObject(json, AckPacket.class);
InetSocketAddress socketAddress = (InetSocketAddress) packet.getSocketAddress();
@ -669,7 +667,7 @@ public class PushService implements ApplicationContextAware, ApplicationListener
long pushCost = System.currentTimeMillis() - udpSendTimeMap.get(ackKey);
Loggers.PUSH.info("received ack: {} from: {}:, cost: {} ms, unacked: {}, total push: {}",
Loggers.PUSH.info("received ack: {} from: {}:{}, cost: {} ms, unacked: {}, total push: {}",
json, ip, port, pushCost, ackMap.size(), totalPush);
pushCostMap.put(ackKey, pushCost);