comparison packet.c @ 70:b0316ce64e4b

Merging in the changes from 0.41-0.43 main Dropbear tree
author Matt Johnston <matt@ucc.asn.au>
date Thu, 12 Aug 2004 16:41:58 +0000
parents f789045062e6
children 0cfba3034be5
comparison
equal deleted inserted replaced
69:59d16db56e9f 70:b0316ce64e4b
48 48
49 /* non-blocking function writing out a current encrypted packet */ 49 /* non-blocking function writing out a current encrypted packet */
50 void write_packet() { 50 void write_packet() {
51 51
52 int len, written; 52 int len, written;
53 buffer * writebuf; 53 buffer * writebuf = NULL;
54 54
55 TRACE(("enter write_packet")); 55 TRACE(("enter write_packet"));
56 assert(!isempty(&ses.writequeue)); 56 assert(!isempty(&ses.writequeue));
57 57
58 /* Get the next buffer in the queue of encrypted packets to write*/ 58 /* Get the next buffer in the queue of encrypted packets to write*/
78 78
79 if (written == len) { 79 if (written == len) {
80 /* We've finished with the packet, free it */ 80 /* We've finished with the packet, free it */
81 dequeue(&ses.writequeue); 81 dequeue(&ses.writequeue);
82 buf_free(writebuf); 82 buf_free(writebuf);
83 writebuf = NULL;
83 } else { 84 } else {
84 /* More packet left to write, leave it in the queue for later */ 85 /* More packet left to write, leave it in the queue for later */
85 buf_incrpos(writebuf, written); 86 buf_incrpos(writebuf, written);
86 } 87 }
87 88
501 /* now add a hmac and we're done */ 502 /* now add a hmac and we're done */
502 writemac(writebuf, clearwritebuf); 503 writemac(writebuf, clearwritebuf);
503 504
504 /* clearwritebuf is finished with */ 505 /* clearwritebuf is finished with */
505 buf_free(clearwritebuf); 506 buf_free(clearwritebuf);
507 clearwritebuf = NULL;
506 508
507 /* enqueue the packet for sending */ 509 /* enqueue the packet for sending */
508 buf_setpos(writebuf, 0); 510 buf_setpos(writebuf, 0);
509 enqueue(&ses.writequeue, (void*)writebuf); 511 enqueue(&ses.writequeue, (void*)writebuf);
510 512