1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

Track the total size of every PacketQueue.

The queue-node structure shared between PktIn and PktOut now has a
'formal_size' field, which is initialised appropriately by the various
packet constructors. And the PacketQueue structure has a 'total_size'
field which tracks the sum of the formal sizes of all the packets on
the queue, and is automatically updated by the push, pop and
concatenate functions.

No functional change, and nothing uses the new fields yet: this is
infrastructure that will be used in the next commit.
This commit is contained in:
Simon Tatham
2020-02-05 19:32:22 +00:00
parent 563cb062b8
commit 0ff13ae773
5 changed files with 36 additions and 4 deletions

2
ssh.h
View File

@ -52,6 +52,7 @@ struct ssh_channel;
typedef struct PacketQueueNode PacketQueueNode;
struct PacketQueueNode {
PacketQueueNode *next, *prev;
size_t formal_size; /* contribution to PacketQueueBase's total_size */
bool on_free_queue; /* is this packet scheduled for freeing? */
};
@ -84,6 +85,7 @@ typedef struct PktOut {
typedef struct PacketQueueBase {
PacketQueueNode end;
size_t total_size; /* sum of all formal_size fields on the queue */
struct IdempotentCallback *ic;
} PacketQueueBase;