[memcached] kronuz,
r446: Using WSASendTo() for sendmsg() (fixed a...
commits at code.sixapart.com
commits at code.sixapart.com
Thu Nov 23 22:21:28 UTC 2006
Using WSASendTo() for sendmsg() (fixed all the issues)
U branches/server-win32/Win32-Code/win32.h
Modified: branches/server-win32/Win32-Code/win32.h
===================================================================
--- branches/server-win32/Win32-Code/win32.h 2006-11-23 22:20:27 UTC (rev 445)
+++ branches/server-win32/Win32-Code/win32.h 2006-11-23 22:21:26 UTC (rev 446)
@@ -82,10 +82,8 @@
return ret;
}
-#define MAXPACKETSIZE (1500-28)
__inline int sendmsg(int s, const struct msghdr *msg, int flags)
{
-/*
DWORD dwBufferCount;
int error = WSASendTo((SOCKET) s,
msg->msg_iov,
@@ -108,40 +106,6 @@
}
}
return dwBufferCount;
-
-/*/
- int ret;
- char *cp, *ep;
- char wrkbuf[MAXPACKETSIZE];
-
- int len = msg->msg_iovlen;
- struct iovec *iov = msg->msg_iov;
- for(cp = wrkbuf, ep = wrkbuf + MAXPACKETSIZE; len-- > 0; iov++) {
- char *pp = iov->iov_base;
- int plen = iov->iov_len;
- int clen = (ep - cp);
- while(plen > clen) {
- if(cp - wrkbuf) {
- memcpy(cp, pp, clen);
- ret = send(s, wrkbuf, MAXPACKETSIZE, flags);
- pp += clen;
- plen -= clen;
- cp = wrkbuf;
- clen = (ep - cp);
- } else {
- ret = send(s, pp, clen, flags);
- pp += clen;
- plen -= clen;
- }
- if(ret == -1 && WSAGetLastError() != WSAECONNRESET) return -1;
- }
- memcpy(cp, pp, plen);
- cp += plen;
- }
- ret = send(s, wrkbuf, (cp - wrkbuf), flags);
- if(ret == -1 && WSAGetLastError() == WSAECONNRESET) return 0;
- return ret;
-/**/
}
#endif
More information about the memcached-commits
mailing list