Ticket #40: 1741.diff
| File 1741.diff, 2.4 kB (added by tmm1, 5 months ago) |
|---|
-
a/ext/ed.cpp
old new 581 581 } 582 582 583 583 LastIo = gCurrentLoopTime; 584 char output_buffer [16 * 1024];584 // char output_buffer [16 * 1024]; 585 585 size_t nbytes = 0; 586 586 587 /* 587 588 while ((OutboundPages.size() > 0) && (nbytes < sizeof(output_buffer))) { 588 589 OutboundPage *op = &(OutboundPages[0]); 589 590 if ((nbytes + op->Length - op->Offset) < sizeof (output_buffer)) { … … 599 600 nbytes += len; 600 601 } 601 602 } 603 */ 604 605 int iovcnt = OutboundPages.size(); 606 struct iovec iov[ iovcnt ]; 607 608 for(int i = 0; i < iovcnt; i++){ 609 OutboundPage *op = &(OutboundPages[i]); 610 iov[i].iov_base = (void *)(op->Buffer + op->Offset); 611 iov[i].iov_len = op->Length - op->Offset; 612 nbytes += (op->Length - op->Offset); 613 } 602 614 603 615 // We should never have gotten here if there were no data to write, 604 616 // so assert that as a sanity check. … … 607 619 assert (nbytes > 0); 608 620 609 621 assert (GetSocket() != INVALID_SOCKET); 610 int bytes_written = send (GetSocket(), output_buffer, nbytes, 0); 622 // int bytes_written = send (GetSocket(), output_buffer, nbytes, 0); 623 int bytes_written = writev(GetSocket(), iov, iovcnt); 611 624 612 625 if (bytes_written > 0) { 613 626 OutboundDataSize -= bytes_written; 627 628 int sent = bytes_written; 629 for(int i = 0; i < iovcnt; i++) { 630 if (iov[i].iov_len <= sent) { 631 OutboundPages.pop_front(); 632 sent -= iov[i].iov_len; 633 } else { 634 OutboundPage *op = &(OutboundPages[i]); 635 op->Offset += sent; 636 } 637 } 638 639 /* 614 640 if ((size_t)bytes_written < nbytes) { 615 641 int len = nbytes - bytes_written; 616 642 char *buffer = (char*) malloc (len + 1); … … 620 646 buffer [len] = 0; 621 647 OutboundPages.push_front (OutboundPage (buffer, len)); 622 648 } 649 */ 623 650 624 651 #ifdef HAVE_EPOLL 625 652 EpollEvent.events = (EPOLLIN | (SelectForWrite() ? EPOLLOUT : 0)); -
a/ext/project.h
old new 44 44 #include <sys/types.h> 45 45 #include <sys/stat.h> 46 46 #include <sys/socket.h> 47 #include <sys/uio.h> 47 48 #include <sys/un.h> 48 49 #include <sys/resource.h> 49 50 #include <sys/wait.h>
