Mercurial > dropbear
comparison packet.c @ 1079:acf444bcb115
Fix no-writev fallback
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 02 May 2015 22:47:25 +0800 |
parents | 10f198d4a308 |
children | c6346c63281b |
comparison
equal
deleted
inserted
replaced
1078:b3b772646974 | 1079:acf444bcb115 |
---|---|
59 ssize_t written; | 59 ssize_t written; |
60 #ifdef HAVE_WRITEV | 60 #ifdef HAVE_WRITEV |
61 /* 50 is somewhat arbitrary */ | 61 /* 50 is somewhat arbitrary */ |
62 unsigned int iov_count = 50; | 62 unsigned int iov_count = 50; |
63 struct iovec iov[50]; | 63 struct iovec iov[50]; |
64 #else | |
65 int len; | |
66 buffer* writebuf; | |
67 int packet_type; | |
64 #endif | 68 #endif |
65 | 69 |
66 TRACE2(("enter write_packet")) | 70 TRACE2(("enter write_packet")) |
67 dropbear_assert(!isempty(&ses.writequeue)); | 71 dropbear_assert(!isempty(&ses.writequeue)); |
68 | 72 |
95 | 99 |
96 /* The last byte of the buffer is not to be transmitted, but is | 100 /* The last byte of the buffer is not to be transmitted, but is |
97 * a cleartext packet_type indicator */ | 101 * a cleartext packet_type indicator */ |
98 packet_type = writebuf->data[writebuf->len-1]; | 102 packet_type = writebuf->data[writebuf->len-1]; |
99 len = writebuf->len - 1 - writebuf->pos; | 103 len = writebuf->len - 1 - writebuf->pos; |
104 TRACE2(("write_packet type %d len %d/%d", packet_type, | |
105 len, writebuf->len-1)) | |
100 dropbear_assert(len > 0); | 106 dropbear_assert(len > 0); |
101 /* Try to write as much as possible */ | 107 /* Try to write as much as possible */ |
102 written = write(ses.sock_out, buf_getptr(writebuf, len), len); | 108 written = write(ses.sock_out, buf_getptr(writebuf, len), len); |
103 | 109 |
104 if (written < 0) { | 110 if (written < 0) { |