comparison packet.c @ 33:f789045062e6

Progressing client support
author Matt Johnston <matt@ucc.asn.au>
date Tue, 27 Jul 2004 16:30:46 +0000
parents 08da099e8337
children b0316ce64e4b
comparison
equal deleted inserted replaced
32:8fd0cdbb5b1b 33:f789045062e6
71 dropbear_exit("error writing"); 71 dropbear_exit("error writing");
72 } 72 }
73 } 73 }
74 74
75 if (written == 0) { 75 if (written == 0) {
76 session_remoteclosed(); 76 ses.remoteclosed();
77 } 77 }
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);
120 assert(ses.readbuf != NULL); 120 assert(ses.readbuf != NULL);
121 maxlen = ses.readbuf->len - ses.readbuf->pos; 121 maxlen = ses.readbuf->len - ses.readbuf->pos;
122 len = read(ses.sock, buf_getptr(ses.readbuf, maxlen), maxlen); 122 len = read(ses.sock, buf_getptr(ses.readbuf, maxlen), maxlen);
123 123
124 if (len == 0) { 124 if (len == 0) {
125 session_remoteclosed(); 125 ses.remoteclosed();
126 } 126 }
127 127
128 if (len < 0) { 128 if (len < 0) {
129 if (errno == EINTR || errno == EAGAIN) { 129 if (errno == EINTR || errno == EAGAIN) {
130 TRACE(("leave read_packet: EINTR or EAGAIN")); 130 TRACE(("leave read_packet: EINTR or EAGAIN"));
169 169
170 /* read the rest of the packet if possible */ 170 /* read the rest of the packet if possible */
171 len = read(ses.sock, buf_getwriteptr(ses.readbuf, maxlen), 171 len = read(ses.sock, buf_getwriteptr(ses.readbuf, maxlen),
172 maxlen); 172 maxlen);
173 if (len == 0) { 173 if (len == 0) {
174 session_remoteclosed(); 174 ses.remoteclosed();
175 } 175 }
176 if (len < 0) { 176 if (len < 0) {
177 if (errno == EINTR) { 177 if (errno == EINTR) {
178 TRACE(("leave read_packet_init: EINTR")); 178 TRACE(("leave read_packet_init: EINTR"));
179 return; 179 return;