CVS: winex/dlls/winsock socket.c,1.51,1.52
[email protected] 29 Aug 2007 11:56:38 -0000
| Newsgroups | gmane.comp.emulators.winex.cvs |
|---|---|
| Message-ID | <[email protected]> |
Subject: winex/dlls/winsock socket.c,1.51,1.52Update of /var/lib/cvsd/cvsroot/winex/dlls/winsock
In directory agravaine:/tmp/cvs-serv28958/dlls/winsock
Modified Files:
socket.c
Log Message:
Translate SO_RCVTIMEO and SO_SNDTIMEO parameters for setsockopt
TRAC #2081
On Windows, WS_SO_RCVTIMEO and WS_SO_SNDTIMEO take an int parameter containing the timeout in milliseconds. On UNIX, it takes a struct timeval. Thus, we now do the translation on calls to setsockopt.
Index: socket.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/dlls/winsock/socket.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- socket.c 31 Jul 2007 19:56:27 -0000 1.51
+++ socket.c 29 Aug 2007 11:56:36 -0000 1.52
@@ -2881,6 +2881,7 @@
if (fd != -1)
{
struct linger linger;
+ struct timeval tv;
int woptval;
/* Is a privileged and useless operation, so we don't. */
@@ -2916,6 +2917,29 @@
optval= (char*) &woptval;
optlen=sizeof(int);
}
+#ifdef SO_RCVTIMEO
+ else if ((optname == SO_RCVTIMEO) && optval)
+ {
+ int ms = *(int *)optval;
+
+ tv.tv_sec = ms / 1000;
+ tv.tv_usec = (ms - (tv.tv_sec * 1000)) * 1000;
+ optval = (char *)&tv;
+ optlen = sizeof (tv);
+ }
+#endif
+#ifdef SO_SNDTIMEO
+ else if ((optname == SO_SNDTIMEO) && optval)
+ {
+ int ms = *(int *)optval;
+
+ tv.tv_sec = ms / 1000;
+ tv.tv_usec = (ms - (tv.tv_sec * 1000)) * 1000;
+ optval = (char *)&tv;
+ optlen = sizeof (tv);
+ }
+#endif
+
}
if(optname == SO_RCVBUF && *(int*)optval < 2048) {
WARN("SO_RCVBF for %d bytes is too small: ignored\n", *(int*)optval );