Changeset 490
- Timestamp:
- 07/31/2005 11:02:57 AM (3 years ago)
- Files:
-
- 1 modified
-
branches/lighttpd-1.3.x/src/network.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/lighttpd-1.3.x/src/network.c
r320 r490 421 421 422 422 int network_write_chunkqueue(server *srv, connection *con, chunkqueue *cq) { 423 int ret = -1 , i;423 int ret = -1; 424 424 off_t written = 0; 425 425 #ifdef TCP_CORK 426 int corked = 0; 427 #endif 426 428 server_socket *srv_socket = con->srv_socket; 427 429 … … 439 441 440 442 #ifdef TCP_CORK 441 /* Linux: put a cork into the socket as we want to combine the write() calls */ 442 i = 1; 443 setsockopt(con->fd, IPPROTO_TCP, TCP_CORK, &i, sizeof(i)); 443 /* Linux: put a cork into the socket as we want to combine the write() calls 444 * but only if we really have multiple chunks 445 */ 446 if (cq->first && cq->first->next) { 447 corked = 1; 448 setsockopt(con->fd, IPPROTO_TCP, TCP_CORK, &corked, sizeof(corked)); 449 } 444 450 #endif 445 451 … … 477 483 478 484 chunk *c, *pc = NULL; 485 int i; 479 486 480 487 for (i = 0, c = cq->first; i < ret; i++, c = c->next) { … … 507 514 508 515 #ifdef TCP_CORK 509 i = 0; 510 setsockopt(con->fd, IPPROTO_TCP, TCP_CORK, &i, sizeof(i)); 516 if (corked) { 517 corked = 0; 518 setsockopt(con->fd, IPPROTO_TCP, TCP_CORK, &corked, sizeof(corked)); 519 } 511 520 #endif 512 521

