diff -r a9591a91c004 -r d050449c3b9e src/server/util/io.c --- a/src/server/util/io.c Sat Jan 14 11:27:55 2017 +0100 +++ b/src/server/util/io.c Sun Jan 15 17:53:16 2017 +0100 @@ -32,8 +32,15 @@ #include #include + +#ifdef XP_UNIX #include #include +#endif + +#ifdef XP_WIN32 + +#endif #if defined(LINUX) || defined(SOLARIS) #include @@ -44,10 +51,16 @@ #else #define WS_SENDFILE #endif +#endif + +#ifdef WS_SENDFILE +#define NET_SYS_SENDFILE net_sys_sendfile #else -#define net_sys_sendfile net_fallback_sendfile +#define NET_SYS_SENDFILE net_fallback_sendfile #endif + + #include "../daemon/vfs.h" #include "io.h" #include "pool.h" @@ -57,7 +70,7 @@ (io_write_f)net_sys_write, (io_writev_f)net_sys_writev, (io_read_f)net_sys_read, - (io_sendfile_f)net_sys_sendfile, + (io_sendfile_f)NET_SYS_SENDFILE, (io_close_f)net_sys_close, NULL }; @@ -85,7 +98,7 @@ * SysStream implementation */ -IOStream* sysstream_new(pool_handle_t *pool, int fd) { +IOStream* sysstream_new(pool_handle_t *pool, SYS_SOCKET fd) { SysStream *st = pool_malloc(pool, sizeof(SysStream)); st->st = native_io_funcs; st->fd = fd; @@ -160,7 +173,7 @@ #elif defined(XP_WIN32) ssize_t net_sys_write(SysStream *st, void *buf, size_t nbytes) { - int ret = send(st->socket, buf, nbytes, 0); + int ret = send(st->fd, buf, nbytes, 0); if(ret == SOCKET_ERROR) { return IO_ERROR; } @@ -172,7 +185,7 @@ } ssize_t net_sys_read(SysStream *st, void *buf, size_t nbytes) { - int ret = recv(st->socket, buf, nbytes, 0); + int ret = recv(st->fd, buf, nbytes, 0); if(ret == SOCKET_ERROR) { return IO_ERROR; } @@ -184,7 +197,7 @@ } void net_sys_close(SysStream *st) { - closesocket(st->socket); + closesocket(st->fd); } #endif