From: Guus Sliepen Date: Sat, 16 Jul 2011 20:38:22 +0000 (+0200) Subject: Use usleep() instead of sleep(), MinGW complained. X-Git-Tag: release-1.1pre2~7 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=574b380dfc75ef13ee4accba1f2416165c58a5a2;p=tinc Use usleep() instead of sleep(), MinGW complained. --- diff --git a/src/dropin.c b/src/dropin.c index 4aed74e9..eb17acaa 100644 --- a/src/dropin.c +++ b/src/dropin.c @@ -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; diff --git a/src/dropin.h b/src/dropin.h index a3a22e3f..7b0050d6 100644 --- a/src/dropin.h +++ b/src/dropin.h @@ -41,4 +41,8 @@ extern int vasprintf(char **, const char *, va_list ap); extern int gettimeofday(struct timeval *, void *); #endif +#ifndef HAVE_USLEEP +extern void usleep(long long usec); +#endif + #endif /* __DROPIN_H__ */ diff --git a/src/net.c b/src/net.c index ff08b3ef..f9020b3b 100644 --- a/src/net.c +++ b/src/net.c @@ -193,7 +193,7 @@ static void timeout_handler(int fd, short events, void *event) { 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;