libsoup r1142 - in trunk: . libsoup
- From: tml svn gnome org
- To: svn-commits-list gnome org
- Subject: libsoup r1142 - in trunk: . libsoup
- Date: Wed, 4 Jun 2008 13:25:58 +0000 (UTC)
Author: tml
Date: Wed Jun 4 13:25:57 2008
New Revision: 1142
URL: http://svn.gnome.org/viewvc/libsoup?rev=1142&view=rev
Log:
2008-06-04 Tor Lillqvist <tml novell com>
* libsoup/soup-socket.c (set_fdflags): The SO_RCVTIMEO and
SO_SNDTIMEO options to setsockopt() take int values, in
milliseconds, on Windows. Not struct timeval. Eek. So passing a
struct timeval meant that the tv_sec value (which is first in the
struct) is interpreted as milliseconds. setsockopt apparently
doesn't even get upset by the fact that the option size doesn't
match the sizeof(int) it should expect.
Modified:
trunk/ChangeLog
trunk/libsoup/soup-socket.c
Modified: trunk/libsoup/soup-socket.c
==============================================================================
--- trunk/libsoup/soup-socket.c (original)
+++ trunk/libsoup/soup-socket.c Wed Jun 4 13:25:57 2008
@@ -333,8 +333,8 @@
set_fdflags (SoupSocketPrivate *priv)
{
int opt;
- struct timeval timeout;
#ifndef G_OS_WIN32
+ struct timeval timeout;
int flags;
#endif
@@ -357,6 +357,7 @@
setsockopt (priv->sockfd, SOL_SOCKET,
SO_REUSEADDR, (void *) &opt, sizeof (opt));
+#ifndef G_OS_WIN32
timeout.tv_sec = priv->timeout;
timeout.tv_usec = 0;
setsockopt (priv->sockfd, SOL_SOCKET,
@@ -366,6 +367,18 @@
timeout.tv_usec = 0;
setsockopt (priv->sockfd, SOL_SOCKET,
SO_SNDTIMEO, (void *) &timeout, sizeof (timeout));
+#else
+ if (priv->timeout < G_MAXINT / 1000)
+ opt = priv->timeout * 1000;
+ else
+ opt = 0;
+
+ setsockopt (priv->sockfd, SOL_SOCKET,
+ SO_RCVTIMEO, (void *) &opt, sizeof (opt));
+
+ setsockopt (priv->sockfd, SOL_SOCKET,
+ SO_SNDTIMEO, (void *) &opt, sizeof (opt));
+#endif
#ifndef G_OS_WIN32
priv->iochannel =
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]