mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-29 01:03:57 +03:00
Add session/channel byte/packet counters
Signed-off-by: Audrius Butkevicius <audrius.butkevicius@elastichosts.com>
This commit is contained in:
committed by
Aris Adamantiadis
parent
370d4b014d
commit
a277dd9277
@@ -311,6 +311,10 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
|
||||
#endif /* WITH_ZLIB */
|
||||
payloadsize = buffer_get_rest_len(session->in_buffer);
|
||||
session->recv_seq++;
|
||||
if (session->raw_counter != NULL) {
|
||||
session->raw_counter->in_bytes += payloadsize;
|
||||
session->raw_counter->in_packets++;
|
||||
}
|
||||
|
||||
/*
|
||||
* We don't want to rewrite a new packet while still executing the
|
||||
@@ -560,6 +564,10 @@ static int packet_send2(ssh_session session) {
|
||||
|
||||
rc = ssh_packet_write(session);
|
||||
session->send_seq++;
|
||||
if (session->raw_counter != NULL) {
|
||||
session->raw_counter->out_bytes += payloadsize;
|
||||
session->raw_counter->out_packets++;
|
||||
}
|
||||
|
||||
SSH_LOG(SSH_LOG_PACKET,
|
||||
"packet: wrote [len=%d,padding=%hhd,comp=%d,payload=%d]",
|
||||
|
||||
Reference in New Issue
Block a user