Mercurial > dropbear
comparison netio.c @ 1034:107b013e9d9d fastopen
avoid some warnings
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 20 Feb 2015 23:43:59 +0800 |
parents | ca71904cf3ee |
children | 8ed1d37e75a6 |
comparison
equal
deleted
inserted
replaced
1033:ca71904cf3ee | 1034:107b013e9d9d |
---|---|
272 } | 272 } |
273 | 273 |
274 struct iovec * packet_queue_to_iovec(struct Queue *queue, int *ret_iov_count) { | 274 struct iovec * packet_queue_to_iovec(struct Queue *queue, int *ret_iov_count) { |
275 struct iovec *iov = NULL; | 275 struct iovec *iov = NULL; |
276 struct Link *l; | 276 struct Link *l; |
277 unsigned int i, packet_type; | 277 unsigned int i; |
278 int len; | 278 int len; |
279 buffer *writebuf; | 279 buffer *writebuf; |
280 | 280 |
281 #ifndef IOV_MAX | 281 #ifndef IOV_MAX |
282 #define IOV_MAX UIO_MAXIOV | 282 #define IOV_MAX UIO_MAXIOV |
286 | 286 |
287 iov = m_malloc(sizeof(*iov) * *ret_iov_count); | 287 iov = m_malloc(sizeof(*iov) * *ret_iov_count); |
288 for (l = queue->head, i = 0; l; l = l->link, i++) | 288 for (l = queue->head, i = 0; l; l = l->link, i++) |
289 { | 289 { |
290 writebuf = (buffer*)l->item; | 290 writebuf = (buffer*)l->item; |
291 packet_type = writebuf->data[writebuf->len-1]; | |
292 len = writebuf->len - 1 - writebuf->pos; | 291 len = writebuf->len - 1 - writebuf->pos; |
293 dropbear_assert(len > 0); | 292 dropbear_assert(len > 0); |
294 TRACE2(("write_packet writev #%d type %d len %d/%d", i, packet_type, | 293 TRACE2(("write_packet writev #%d type %d len %d/%d", i, writebuf->data[writebuf->len-1], |
295 len, writebuf->len-1)) | 294 len, writebuf->len-1)) |
296 iov[i].iov_base = buf_getptr(writebuf, len); | 295 iov[i].iov_base = buf_getptr(writebuf, len); |
297 iov[i].iov_len = len; | 296 iov[i].iov_len = len; |
298 } | 297 } |
299 | 298 |
336 | 335 |
337 #endif | 336 #endif |
338 | 337 |
339 void set_sock_priority(int sock, enum dropbear_prio prio) { | 338 void set_sock_priority(int sock, enum dropbear_prio prio) { |
340 | 339 |
341 int iptos_val = 0, so_prio_val = 0, rc; | 340 int rc; |
341 #ifdef IPTOS_LOWDELAY | |
342 int iptos_val = 0; | |
343 #endif | |
344 #ifdef SO_PRIORITY | |
345 int so_prio_val = 0; | |
346 #endif | |
347 | |
342 | 348 |
343 /* Don't log ENOTSOCK errors so that this can harmlessly be called | 349 /* Don't log ENOTSOCK errors so that this can harmlessly be called |
344 * on a client '-J' proxy pipe */ | 350 * on a client '-J' proxy pipe */ |
345 | 351 |
346 /* set the TOS bit for either ipv4 or ipv6 */ | 352 /* set the TOS bit for either ipv4 or ipv6 */ |