mirror of
https://github.com/rofl0r/proxychains-ng
synced 2025-01-23 01:12:59 +08:00
print everything to stderr, and fflush on PDEBUG
This commit is contained in:
parent
1fc7e38ee0
commit
364c785970
23
src/core.c
23
src/core.c
@ -230,26 +230,15 @@ static int timed_connect(int sock, const struct sockaddr *addr, socklen_t len) {
|
|||||||
pfd[0].events = POLLOUT;
|
pfd[0].events = POLLOUT;
|
||||||
fcntl(sock, F_SETFL, O_NONBLOCK);
|
fcntl(sock, F_SETFL, O_NONBLOCK);
|
||||||
ret = true_connect(sock, addr, len);
|
ret = true_connect(sock, addr, len);
|
||||||
#ifdef DEBUG
|
PDEBUG("\nconnect ret=%d\n", ret);
|
||||||
if(ret == -1)
|
|
||||||
perror("true_connect");
|
|
||||||
printf("\nconnect ret=%d\n", ret);
|
|
||||||
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
if(ret == -1 && errno == EINPROGRESS) {
|
if(ret == -1 && errno == EINPROGRESS) {
|
||||||
ret = poll_retry(pfd, 1, tcp_connect_time_out);
|
ret = poll_retry(pfd, 1, tcp_connect_time_out);
|
||||||
#ifdef DEBUG
|
PDEBUG("\npoll ret=%d\n", ret);
|
||||||
printf("\npoll ret=%d\n", ret);
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
if(ret == 1) {
|
if(ret == 1) {
|
||||||
value_len = sizeof(socklen_t);
|
value_len = sizeof(socklen_t);
|
||||||
getsockopt(sock, SOL_SOCKET, SO_ERROR, &value, &value_len);
|
getsockopt(sock, SOL_SOCKET, SO_ERROR, &value, &value_len);
|
||||||
#ifdef DEBUG
|
PDEBUG("\nvalue=%d\n", value);
|
||||||
printf("\nvalue=%d\n", value);
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
if(!value)
|
if(!value)
|
||||||
ret = 0;
|
ret = 0;
|
||||||
else
|
else
|
||||||
@ -258,6 +247,10 @@ static int timed_connect(int sock, const struct sockaddr *addr, socklen_t len) {
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef DEBUG
|
||||||
|
if(ret == -1)
|
||||||
|
perror("true_connect");
|
||||||
|
#endif
|
||||||
if(ret != 0)
|
if(ret != 0)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ int proxy_getaddrinfo(const char *node, const char *service,
|
|||||||
void pc_stringfromipv4(unsigned char *ip_buf_4_bytes, char *outbuf_16_bytes);
|
void pc_stringfromipv4(unsigned char *ip_buf_4_bytes, char *outbuf_16_bytes);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
# define PDEBUG(fmt, args...) fprintf(stderr,"DEBUG:"fmt, ## args)
|
# define PDEBUG(fmt, args...) do { fprintf(stderr,"DEBUG:"fmt, ## args); fflush(stderr); } while(0)
|
||||||
#else
|
#else
|
||||||
# define PDEBUG(fmt, args...) do {} while (0)
|
# define PDEBUG(fmt, args...) do {} while (0)
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user