diff --git a/src/Makefile b/src/Makefile index fc1f80f..14465c8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,5 @@ -COMMONOBJS = tun.o dns.o read.o encoding.o login.o base32.o base64.o base64u.o base128.o md5.o window.o common.o -CLIENTOBJS = iodine.o client.o util.o +COMMONOBJS = tun.o dns.o read.o encoding.o login.o base32.o base64.o base64u.o base128.o md5.o window.o common.o util.o +CLIENTOBJS = iodine.o client.o CLIENT = ../bin/iodine SERVEROBJS = iodined.o user.o fw_query.o server.o SERVER = ../bin/iodined @@ -13,7 +13,7 @@ LDFLAGS += -lz `sh osflags $(TARGETOS) link` $(LIBPATH) CFLAGS += -std=c99 -c -Wall -D$(OS) -pedantic `sh osflags $(TARGETOS) cflags` -DGITREVISION=\"$(HEAD_COMMIT)\" CFLAGS_RELEASE = -O3 -fno-strict-aliasing -CFLAGS_DEBUG = -g -Og -DDEBUG_BUILD +CFLAGS_DEBUG = -g -O0 -DDEBUG_BUILD all: CFLAGS += $(CFLAGS_RELEASE) all: executables diff --git a/src/client.c b/src/client.c index 2220422..08bdf2c 100644 --- a/src/client.c +++ b/src/client.c @@ -571,7 +571,7 @@ send_query(int fd, uint8_t *hostname) and if user hasn't specified server timeout/window timeout etc. */ num_sent++; - if (send_query_sendcnt >= 0 && send_query_sendcnt < 100 && + if (send_query_sendcnt > 0 && send_query_sendcnt < 100 && lazymode && connected && autodetect_server_timeout) { send_query_sendcnt++; diff --git a/src/common.h b/src/common.h index 3672c96..e360145 100644 --- a/src/common.h +++ b/src/common.h @@ -87,7 +87,7 @@ extern const unsigned char raw_header[RAW_HDR_LEN]; #define TIMEPRINT(...) \ struct timeval currenttime;\ gettimeofday(¤ttime, NULL);\ - fprintf(stderr, "%03ld.%03ld ", currenttime.tv_sec, currenttime.tv_usec / 1000);\ + fprintf(stderr, "%03ld.%03ld ", (long) currenttime.tv_sec, (long) currenttime.tv_usec / 1000);\ fprintf(stderr, __VA_ARGS__); #define DEBUG(level, ...) \ diff --git a/src/util.c b/src/util.c index 5780031..3bd162c 100644 --- a/src/util.c +++ b/src/util.c @@ -18,6 +18,23 @@ #include #include "common.h" +time_t +timeval_to_ms(struct timeval *tv) +{ + time_t ms = tv->tv_sec * 1000; + ms += (tv->tv_usec + 500) / 1000; + return ms; +} + +struct timeval +ms_to_timeval(time_t ms) +{ + struct timeval tv; + tv.tv_sec = ms / 1000; + tv.tv_usec = (ms - tv.tv_sec * 1000) * 1000; + return tv; +} + char * get_resolvconf_addr() { diff --git a/src/util.h b/src/util.h index 9a99a49..e232531 100644 --- a/src/util.h +++ b/src/util.h @@ -24,21 +24,8 @@ char *get_resolvconf_addr(); void socket_setrtable(int fd, int rtable); -inline time_t -timeval_to_ms(struct timeval *tv) -{ - time_t ms = tv->tv_sec * 1000; - ms += (tv->tv_usec + 500) / 1000; - return ms; -} +time_t timeval_to_ms(struct timeval *tv); -inline struct timeval -ms_to_timeval(time_t ms) -{ - struct timeval tv; - tv.tv_sec = ms / 1000; - tv.tv_usec = (ms - tv.tv_sec * 1000) * 1000; - return tv; -} +struct timeval ms_to_timeval(time_t ms); #endif