mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-28 20:45:12 +00:00
Fixed clang warnings + debug build
This commit is contained in:
parent
e3531378b5
commit
68a53c4565
@ -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
|
||||
|
@ -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++;
|
||||
|
||||
|
@ -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, ...) \
|
||||
|
17
src/util.c
17
src/util.c
@ -18,6 +18,23 @@
|
||||
#include <stdio.h>
|
||||
#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()
|
||||
{
|
||||
|
17
src/util.h
17
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
|
||||
|
Loading…
Reference in New Issue
Block a user