mirror of
https://github.com/hufrea/byedpi.git
synced 2025-06-30 02:31:15 +00:00
Fix logging on Android
This commit is contained in:
parent
90d8cd7b7a
commit
02c1918621
4
desync.c
4
desync.c
@ -504,7 +504,7 @@ ssize_t desync(struct poolhd *pool,
|
|||||||
ssize_t skip = val->pair->round_sent;
|
ssize_t skip = val->pair->round_sent;
|
||||||
unsigned int part_skip = val->pair->part_sent;
|
unsigned int part_skip = val->pair->part_sent;
|
||||||
|
|
||||||
if (!skip && params.debug) {
|
if (!skip && LOG_ENABLED) {
|
||||||
init_proto_info(buffer, *np, &info);
|
init_proto_info(buffer, *np, &info);
|
||||||
|
|
||||||
if (info.host_pos) {
|
if (info.host_pos) {
|
||||||
@ -668,7 +668,7 @@ ssize_t desync_udp(int sfd, char *buffer,
|
|||||||
{
|
{
|
||||||
struct desync_params *dp = ¶ms.dp[dp_c];
|
struct desync_params *dp = ¶ms.dp[dp_c];
|
||||||
|
|
||||||
if (params.debug) {
|
if (LOG_ENABLED) {
|
||||||
INIT_HEX_STR(buffer, (n > 16 ? 16 : n));
|
INIT_HEX_STR(buffer, (n > 16 ? 16 : n));
|
||||||
LOG(LOG_S, "bytes: %s (%zd)\n", HEX_STR, n);
|
LOG(LOG_S, "bytes: %s (%zd)\n", HEX_STR, n);
|
||||||
}
|
}
|
||||||
|
2
error.h
2
error.h
@ -63,6 +63,7 @@ static int unie(int e)
|
|||||||
#define LOG_L ANDROID_LOG_VERBOSE
|
#define LOG_L ANDROID_LOG_VERBOSE
|
||||||
#define LOG(s, str, ...) \
|
#define LOG(s, str, ...) \
|
||||||
__android_log_print(s, "proxy", str, ##__VA_ARGS__)
|
__android_log_print(s, "proxy", str, ##__VA_ARGS__)
|
||||||
|
#define LOG_ENABLED 1
|
||||||
#else
|
#else
|
||||||
#define LOG_E -1
|
#define LOG_E -1
|
||||||
#define LOG_S 1
|
#define LOG_S 1
|
||||||
@ -75,6 +76,7 @@ static int unie(int e)
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#define LOG_ENABLED (params.debug >= LOG_S)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define INIT_ADDR_STR(dst) \
|
#define INIT_ADDR_STR(dst) \
|
||||||
|
4
proxy.c
4
proxy.c
@ -430,7 +430,7 @@ int create_conn(struct poolhd *pool,
|
|||||||
close(sfd);
|
close(sfd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (params.debug) {
|
if (LOG_ENABLED) {
|
||||||
INIT_ADDR_STR((*dst));
|
INIT_ADDR_STR((*dst));
|
||||||
LOG(LOG_S, "new conn: fd=%d, pair=%d, addr=%s:%d\n",
|
LOG(LOG_S, "new conn: fd=%d, pair=%d, addr=%s:%d\n",
|
||||||
sfd, val->fd, ADDR_STR, ntohs(dst->in.sin_port));
|
sfd, val->fd, ADDR_STR, ntohs(dst->in.sin_port));
|
||||||
@ -516,7 +516,7 @@ static int udp_associate(struct poolhd *pool,
|
|||||||
close(cfd);
|
close(cfd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (params.debug) {
|
if (LOG_ENABLED) {
|
||||||
INIT_ADDR_STR((*dst));
|
INIT_ADDR_STR((*dst));
|
||||||
LOG(LOG_S, "udp associate: fds=%d,%d,%d addr=%s:%d\n",
|
LOG(LOG_S, "udp associate: fds=%d,%d,%d addr=%s:%d\n",
|
||||||
ufd, cfd, val->fd, ADDR_STR, ntohs(dst->in.sin_port));
|
ufd, cfd, val->fd, ADDR_STR, ntohs(dst->in.sin_port));
|
||||||
|
Loading…
Reference in New Issue
Block a user