mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-09 20:41:27 -04:00
Make the no_iovecs case of write_atmost compile
Apparently nobody had tested it before on a system that had sendfile. Why would you have sendfile and not writev? Perhaps you're trying to test the no-iovecs code to make sure it still works.
This commit is contained in:
parent
96865c4783
commit
8e227b04da
7
buffer.c
7
buffer.c
@ -2010,12 +2010,12 @@ evbuffer_write_atmost(struct evbuffer *buffer, evutil_socket_t fd,
|
|||||||
if (howmuch < 0 || howmuch > buffer->total_len)
|
if (howmuch < 0 || howmuch > buffer->total_len)
|
||||||
howmuch = buffer->total_len;
|
howmuch = buffer->total_len;
|
||||||
|
|
||||||
{
|
if (howmuch > 0) {
|
||||||
#ifdef USE_SENDFILE
|
#ifdef USE_SENDFILE
|
||||||
struct evbuffer_chain *chain = buffer->first;
|
struct evbuffer_chain *chain = buffer->first;
|
||||||
if (chain != NULL && (chain->flags & EVBUFFER_SENDFILE))
|
if (chain != NULL && (chain->flags & EVBUFFER_SENDFILE))
|
||||||
n = evbuffer_write_sendfile(buffer, fd, howmuch);
|
n = evbuffer_write_sendfile(buffer, fd, howmuch);
|
||||||
else
|
else {
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_IOVEC_IMPL
|
#ifdef USE_IOVEC_IMPL
|
||||||
n = evbuffer_write_iovec(buffer, fd, howmuch);
|
n = evbuffer_write_iovec(buffer, fd, howmuch);
|
||||||
@ -2027,6 +2027,9 @@ evbuffer_write_atmost(struct evbuffer *buffer, evutil_socket_t fd,
|
|||||||
#else
|
#else
|
||||||
void *p = evbuffer_pullup(buffer, howmuch);
|
void *p = evbuffer_pullup(buffer, howmuch);
|
||||||
n = write(fd, p, howmuch);
|
n = write(fd, p, howmuch);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_SENDFILE
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user