Mercurial > dropbear
comparison packet.c @ 479:e3db1f7a2e43
- Split main socket var into ses.sock_in/ses.sock_out in preparation
for -J proxy_cmd option (and some prelim options for that)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 15 Sep 2008 12:51:50 +0000 |
parents | f6c999ba31da |
children | d58c478bd399 |
comparison
equal
deleted
inserted
replaced
477:657c045054ab | 479:e3db1f7a2e43 |
---|---|
59 writebuf = (buffer*)examine(&ses.writequeue); | 59 writebuf = (buffer*)examine(&ses.writequeue); |
60 | 60 |
61 len = writebuf->len - writebuf->pos; | 61 len = writebuf->len - writebuf->pos; |
62 dropbear_assert(len > 0); | 62 dropbear_assert(len > 0); |
63 /* Try to write as much as possible */ | 63 /* Try to write as much as possible */ |
64 written = write(ses.sock, buf_getptr(writebuf, len), len); | 64 written = write(ses.sock_out, buf_getptr(writebuf, len), len); |
65 | 65 |
66 if (written < 0) { | 66 if (written < 0) { |
67 if (errno == EINTR) { | 67 if (errno == EINTR) { |
68 TRACE(("leave writepacket: EINTR")) | 68 TRACE(("leave writepacket: EINTR")) |
69 return; | 69 return; |
120 | 120 |
121 /* Attempt to read the remainder of the packet, note that there | 121 /* Attempt to read the remainder of the packet, note that there |
122 * mightn't be any available (EAGAIN) */ | 122 * mightn't be any available (EAGAIN) */ |
123 dropbear_assert(ses.readbuf != NULL); | 123 dropbear_assert(ses.readbuf != NULL); |
124 maxlen = ses.readbuf->len - ses.readbuf->pos; | 124 maxlen = ses.readbuf->len - ses.readbuf->pos; |
125 len = read(ses.sock, buf_getptr(ses.readbuf, maxlen), maxlen); | 125 len = read(ses.sock_in, buf_getptr(ses.readbuf, maxlen), maxlen); |
126 | 126 |
127 if (len == 0) { | 127 if (len == 0) { |
128 ses.remoteclosed(); | 128 ses.remoteclosed(); |
129 } | 129 } |
130 | 130 |
169 } | 169 } |
170 | 170 |
171 maxlen = blocksize - ses.readbuf->pos; | 171 maxlen = blocksize - ses.readbuf->pos; |
172 | 172 |
173 /* read the rest of the packet if possible */ | 173 /* read the rest of the packet if possible */ |
174 len = read(ses.sock, buf_getwriteptr(ses.readbuf, maxlen), | 174 len = read(ses.sock_in, buf_getwriteptr(ses.readbuf, maxlen), |
175 maxlen); | 175 maxlen); |
176 if (len == 0) { | 176 if (len == 0) { |
177 ses.remoteclosed(); | 177 ses.remoteclosed(); |
178 } | 178 } |
179 if (len < 0) { | 179 if (len < 0) { |