mirror of
https://github.com/ntop/n2n.git
synced 2024-09-19 00:21:11 +02:00
Address more windows compile warnings
This commit is contained in:
parent
5942726685
commit
041233dc8b
|
@ -1140,7 +1140,7 @@ static void sendto_sock (n2n_edge_t *eee, const void * buf,
|
|||
// if the connection is tcp, i.e. not the regular sock...
|
||||
if(eee->conf.connect_tcp) {
|
||||
|
||||
setsockopt(eee->sock, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value));
|
||||
setsockopt(eee->sock, IPPROTO_TCP, TCP_NODELAY, (void *)&value, sizeof(value));
|
||||
value = 1;
|
||||
#ifdef LINUX
|
||||
setsockopt(eee->sock, IPPROTO_TCP, TCP_CORK, &value, sizeof(value));
|
||||
|
@ -1159,7 +1159,7 @@ static void sendto_sock (n2n_edge_t *eee, const void * buf,
|
|||
// if the connection is tcp, i.e. not the regular sock...
|
||||
if(eee->conf.connect_tcp) {
|
||||
value = 1; /* value should still be set to 1 */
|
||||
setsockopt(eee->sock, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value));
|
||||
setsockopt(eee->sock, IPPROTO_TCP, TCP_NODELAY, (void *)&value, sizeof(value));
|
||||
#ifdef LINUX
|
||||
value = 0;
|
||||
setsockopt(eee->sock, IPPROTO_TCP, TCP_CORK, &value, sizeof(value));
|
||||
|
@ -2791,7 +2791,7 @@ int fetch_and_eventually_process_data (n2n_edge_t *eee, SOCKET sock,
|
|||
#endif
|
||||
) {
|
||||
// udp
|
||||
bread = recvfrom(sock, pktbuf, N2N_PKT_BUF_SIZE, 0 /*flags*/,
|
||||
bread = recvfrom(sock, (void *)pktbuf, N2N_PKT_BUF_SIZE, 0 /*flags*/,
|
||||
sender_sock, &ss_size);
|
||||
|
||||
if((bread < 0)
|
||||
|
@ -2817,7 +2817,7 @@ int fetch_and_eventually_process_data (n2n_edge_t *eee, SOCKET sock,
|
|||
} else {
|
||||
// tcp
|
||||
bread = recvfrom(sock,
|
||||
pktbuf + *position, *expected - *position, 0 /*flags*/,
|
||||
(void *)(pktbuf + *position), *expected - *position, 0 /*flags*/,
|
||||
sender_sock, &ss_size);
|
||||
if((bread <= 0) && (errno)) {
|
||||
traceEvent(TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", bread, errno, strerror(errno));
|
||||
|
|
|
@ -82,7 +82,10 @@ SOCKET open_socket (int local_port, in_addr_t address, int type /* 0 = UDP, TCP
|
|||
|
||||
|
||||
static int traceLevel = 2 /* NORMAL */;
|
||||
static int useSyslog = 0, syslog_opened = 0;
|
||||
static int useSyslog = 0;
|
||||
#ifndef WIN32
|
||||
static int syslog_opened = 0;
|
||||
#endif
|
||||
static FILE *traceFile = NULL;
|
||||
|
||||
int getTraceLevel () {
|
||||
|
|
|
@ -566,7 +566,7 @@ static ssize_t sendto_sock(n2n_sn_t *sss,
|
|||
// if the connection is tcp, i.e. not the regular sock...
|
||||
if((socket_fd >= 0) && (socket_fd != sss->sock)) {
|
||||
value = 1; /* value should still be set to 1 */
|
||||
setsockopt(socket_fd, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value));
|
||||
setsockopt(socket_fd, IPPROTO_TCP, TCP_NODELAY, (void *)&value, sizeof(value));
|
||||
#ifdef LINUX
|
||||
value = 0;
|
||||
setsockopt(socket_fd, IPPROTO_TCP, TCP_CORK, &value, sizeof(value));
|
||||
|
|
|
@ -50,8 +50,10 @@
|
|||
|
||||
// REVISIT: may become obsolete
|
||||
#ifdef WIN32
|
||||
#ifndef STDIN_FILENO
|
||||
#define STDIN_FILENO _fileno(stdin)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct n2n_portfwd_conf {
|
||||
|
@ -197,6 +199,11 @@ int _kbhit () {
|
|||
|
||||
return FD_ISSET(STDIN_FILENO, &fds);
|
||||
}
|
||||
#else
|
||||
// A dummy definition to avoid compile errors on windows
|
||||
int _kbhit () {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -75,8 +75,10 @@
|
|||
|
||||
// REVISIT: may become obsolete
|
||||
#ifdef WIN32
|
||||
#ifndef STDIN_FILENO
|
||||
#define STDIN_FILENO _fileno(stdin)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct n2n_route {
|
||||
|
@ -496,7 +498,6 @@ void handle_route (n2n_route_t* in_route, int verb) {
|
|||
|
||||
#elif defined(WIN32)
|
||||
// REVISIT: use 'CreateIpForwardEntry()' and 'DeleteIpForwardEntry()' [iphlpapi.h]
|
||||
struct in_addr net_addr, gateway;
|
||||
char c_net_addr[32];
|
||||
char c_gateway[32];
|
||||
char c_interface[32];
|
||||
|
@ -657,6 +658,11 @@ int _kbhit () {
|
|||
|
||||
return FD_ISSET(STDIN_FILENO, &fds);
|
||||
}
|
||||
#else
|
||||
// A dummy definition to avoid compile errors on windows
|
||||
int _kbhit () {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user