]> granicus.if.org Git - libevent/commitdiff
Fix win32 compilation issues.
authorNick Mathewson <nickm@torproject.org>
Thu, 23 Apr 2009 18:04:50 +0000 (18:04 +0000)
committerNick Mathewson <nickm@torproject.org>
Thu, 23 Apr 2009 18:04:50 +0000 (18:04 +0000)
svn:r1234

evdns.c
test/bench_httpclient.c
test/regress_minheap.c
test/tinytest.c

diff --git a/evdns.c b/evdns.c
index f4051d2ec2f9925e3a2f9afc4fce1070e13c5059..a1d9431dd5410d47bf2c03d1d203db99fd794aec 100644 (file)
--- a/evdns.c
+++ b/evdns.c
@@ -3392,7 +3392,7 @@ load_nameservers_with_getnetworkparams(struct evdns_base *base)
        IP_ADDR_STRING *ns;
        GetNetworkParams_fn_t fn;
 
-       ASSERT_LOCKD(base);
+       ASSERT_LOCKED(base);
        if (!(handle = LoadLibrary("iphlpapi.dll"))) {
                log(EVDNS_LOG_WARN, "Could not open iphlpapi.dll");
                status = -1;
index 15079ed334aa3dd7ce4872f043966f8d610a0840..299d8ec279e67b72672af40353a261f246cc1e9d 100644 (file)
  */
 
 #include <sys/types.h>
+#ifdef WIN32
+#include <winsock2.h>
+#else
 #include <sys/socket.h>
 #include <netinet/in.h>
+#endif
 #include <stdlib.h>
 #include <errno.h>
 
@@ -36,6 +40,9 @@
 #include <event2/buffer.h>
 #include <event2/util.h>
 
+/* for EVUTIL_ERR_CONNECT_RETRIABLE macro */
+#include "util-internal.h"
+
 const char *resource = NULL;
 struct event_base *base = NULL;
 
@@ -104,10 +111,10 @@ frob_socket(int sock)
 {
        struct linger l;
        int one = 1;
-       setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
+       setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*)&one, sizeof(one));
        l.l_onoff = 1;
        l.l_linger = 0;
-       if (setsockopt(sock, SOL_SOCKET, SO_LINGER, &l, sizeof(l))<0)
+       if (setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&l, sizeof(l))<0)
                perror("setsockopt");
 }
 
@@ -131,7 +138,8 @@ launch_request(void)
                return -1;
        frob_socket(sock);
        if (connect(sock, (struct sockaddr*)&sin, sizeof(sin)) < 0) {
-               if (errno != EINTR && errno != EINPROGRESS) {
+               int e = errno;
+               if (! EVUTIL_ERR_CONNECT_RETRIABLE(e)) {
                        return -1;
                }
        }
index 57000afe4fb7864c5dc13d46c7d0a74f5ffa0ea3..84aab4e1846c94a1746b36ec5088d205c0ef44c2 100644 (file)
@@ -34,8 +34,8 @@
 static void
 set_random_timeout(struct event *ev)
 {
-       ev->ev_timeout.tv_sec = random();
-       ev->ev_timeout.tv_usec = random();
+       ev->ev_timeout.tv_sec = rand();
+       ev->ev_timeout.tv_usec = rand();
        ev->min_heap_idx = -1;
 }
 
index b07d4d9be0e286857dc2991897268ae3e1137a0a..07483b8c837b6812b02bf877a0de96b26a99736e 100644 (file)
@@ -102,7 +102,7 @@ _testcase_run_forked(const struct testgroup_t *group,
         */
        int ok;
        char buffer[LONGEST_TEST_NAME+256];
-       const char *verbosity;
+       //const char *verbosity;
        STARTUPINFO si;
        PROCESS_INFORMATION info;
        DWORD exitcode;