Index: fd.cc =================================================================== RCS file: /cvsroot/squid/squid3/src/fd.cc,v retrieving revision 1.4 diff -u -p -r1.4 fd.cc --- fd.cc 23 Jan 2003 03:14:42 -0000 1.4 +++ fd.cc 1 Feb 2003 11:32:42 -0000 @@ -38,6 +38,12 @@ int default_read_method(int, char *, int); int default_write_method(int, const char *, int); +#ifdef _SQUID_MSWIN_ +int socket_read_method(int, char *, int); +int socket_write_method(int, const char *, int); +int file_read_method(int, char *, int); +int file_write_method(int, const char *, int); +#endif const char *fdTypeStr[] = { @@ -94,6 +100,32 @@ fd_close(int fd) F->timeout = 0; } +#ifdef _SQUID_MSWIN_ + +int +socket_read_method(int fd, char *buf, int len) +{ + return (recv(fd, buf, len, 0)); +} + +int +file_read_method(int fd, char *buf, int len) +{ + return (_read(fd, buf, len)); +} + +int +socket_write_method(int fd, const char *buf, int len) +{ + return (send(fd, buf, len, 0)); +} + +int +file_write_method(int fd, const char *buf, int len) +{ + return (_write(fd, buf, len)); +} +#else int default_read_method(int fd, char *buf, int len) { @@ -105,6 +137,7 @@ default_write_method(int fd, const char { return (write(fd, buf, len)); } +#endif void fd_open(int fd, unsigned int type, const char *desc) @@ -120,8 +153,25 @@ fd_open(int fd, unsigned int type, const debug(51, 3) ("fd_open FD %d %s\n", fd, desc); F->type = type; F->flags.open = 1; +#ifdef _SQUID_MSWIN_ + switch (type) { + case FD_SOCKET: + case FD_PIPE: + F->read_method = &socket_read_method; + F->write_method = &socket_write_method; + break; + case FD_FILE: + case FD_LOG: + F->read_method = &file_read_method; + F->write_method = &file_write_method; + break; + default: + fatalf("fd_open(): unknown FD type - FD#: %i, type: %u, desc %s\n", fd, type, desc); + } +#else F->read_method = &default_read_method; F->write_method = &default_write_method; +#endif fdUpdateBiggest(fd, 1); if (desc) xstrncpy(F->desc, desc, FD_DESC_SZ);