comparison netio.c @ 1073:88043f9d40bd

Fix when iov queue is large
author Matt Johnston <matt@ucc.asn.au>
date Fri, 20 Mar 2015 23:33:45 +0800
parents 686cd3e8e13e
children d92597ef089e
comparison
equal deleted inserted replaced
1072:686cd3e8e13e 1073:88043f9d40bd
271 #define IOV_MAX UIO_MAXIOV 271 #define IOV_MAX UIO_MAXIOV
272 #endif 272 #endif
273 273
274 *iov_count = MIN(MIN(queue->count, IOV_MAX), *iov_count); 274 *iov_count = MIN(MIN(queue->count, IOV_MAX), *iov_count);
275 275
276 for (l = queue->head, i = 0; l; l = l->link, i++) 276 for (l = queue->head, i = 0; i < *iov_count; l = l->link, i++)
277 { 277 {
278 writebuf = (buffer*)l->item; 278 writebuf = (buffer*)l->item;
279 len = writebuf->len - 1 - writebuf->pos; 279 len = writebuf->len - 1 - writebuf->pos;
280 dropbear_assert(len > 0); 280 dropbear_assert(len > 0);
281 TRACE2(("write_packet writev #%d type %d len %d/%d", i, writebuf->data[writebuf->len-1], 281 TRACE2(("write_packet writev #%d type %d len %d/%d", i, writebuf->data[writebuf->len-1],