Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete duplicate code and fix log error #2390

Merged
merged 2 commits into from
Mar 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,6 @@ private static Receiver.AckEntry prepareAckEntry(PushClient client, byte[] dataB
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;
Expand Down Expand Up @@ -649,7 +647,7 @@ public void run() {
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();
Expand All @@ -669,7 +667,7 @@ public void run() {

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);
Expand Down