]> git.meshlink.io Git - meshlink/commitdiff
Use usleep() instead of sleep(), MinGW complained.
authorGuus Sliepen <guus@tinc-vpn.org>
Sat, 23 Jul 2011 12:11:44 +0000 (14:11 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Sat, 23 Jul 2011 12:11:44 +0000 (14:11 +0200)
lib/dropin.c
lib/dropin.h
src/net.c

index 4aed74e95125b6492f9ecc64e464d771f3fe9970..eb17acaad082ecb40d489bd5f7c0022cdadcd7d7 100644 (file)
@@ -165,7 +165,7 @@ int gettimeofday(struct timeval *tv, void *tz) {
 #endif
 
 #ifndef HAVE_USLEEP
-int usleep(long usec) {
+int usleep(long long usec) {
        struct timeval tv = {usec / 1000000, (usec / 1000) % 1000};
        select(0, NULL, NULL, NULL, &tv);
        return 0;
index 22fe36d394f683eb30b8c086c5dc543475f94750..dc7dbee22aabb1791530d35e6972e5642bb8c09d 100644 (file)
@@ -42,7 +42,7 @@ extern int gettimeofday(struct timeval *, void *);
 #endif
 
 #ifndef HAVE_USLEEP
-extern int usleep(long);
+extern int usleep(long long);
 #endif
 
 #endif                                                 /* __DROPIN_H__ */
index b3f924ad661232312427abf929aadc6b4af1e361..8762db3841912c5395dfdbe68a8c1d9710cf1512 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -472,7 +472,7 @@ int main_loop(void) {
 
                        if(contradicting_del_edge > 100 && contradicting_add_edge > 100) {
                                logger(LOG_WARNING, "Possible node with same Name as us! Sleeping %d seconds.", sleeptime);
-                               sleep(sleeptime);
+                               usleep(sleeptime * 1000000LL);
                                sleeptime *= 2;
                                if(sleeptime < 0)
                                        sleeptime = 3600;