mirror of
https://github.com/ChronosX88/KademliaDHT.git
synced 2024-11-22 10:12:19 +00:00
Statistics
- Added aggregation of total data sent and received by Server
This commit is contained in:
parent
899390b4a3
commit
2adfc9b277
@ -176,6 +176,9 @@ public class KadServer
|
|||||||
DatagramPacket pkt = new DatagramPacket(data, 0, data.length);
|
DatagramPacket pkt = new DatagramPacket(data, 0, data.length);
|
||||||
pkt.setSocketAddress(to.getSocketAddress());
|
pkt.setSocketAddress(to.getSocketAddress());
|
||||||
socket.send(pkt);
|
socket.send(pkt);
|
||||||
|
|
||||||
|
/* Lets inform the statistician that we've sent some data */
|
||||||
|
this.statistician.sentData(data.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,8 +198,8 @@ public class KadServer
|
|||||||
DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
|
DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
|
||||||
socket.receive(packet);
|
socket.receive(packet);
|
||||||
|
|
||||||
//Statistics.dataReceived += packet.getLength();
|
/* Lets inform the statistician that we've received some data */
|
||||||
//System.out.println("Received packet of size: " + packet.getLength());
|
this.statistician.receivedData(packet.getLength());
|
||||||
|
|
||||||
/* We've received a packet, now handle it */
|
/* We've received a packet, now handle it */
|
||||||
try (ByteArrayInputStream bin = new ByteArrayInputStream(packet.getData(), packet.getOffset(), packet.getLength());
|
try (ByteArrayInputStream bin = new ByteArrayInputStream(packet.getData(), packet.getOffset(), packet.getLength());
|
||||||
|
Loading…
Reference in New Issue
Block a user