mirror of
https://github.com/hufrea/byedpi.git
synced 2024-12-22 22:35:39 +00:00
fix ssize_t print format
This commit is contained in:
parent
632e6b038b
commit
ff4f811692
16
desync.c
16
desync.c
@ -392,12 +392,12 @@ ssize_t desync(int sfd, char *buffer, size_t bfsize,
|
|||||||
type = IS_HTTP;
|
type = IS_HTTP;
|
||||||
}
|
}
|
||||||
if (len && host) {
|
if (len && host) {
|
||||||
LOG(LOG_S, "host: %.*s (%ld)\n",
|
LOG(LOG_S, "host: %.*s (%zd)\n",
|
||||||
len, host, host - buffer);
|
len, host, host - buffer);
|
||||||
}
|
}
|
||||||
// modify packet
|
// modify packet
|
||||||
if (type == IS_HTTP && dp.mod_http) {
|
if (type == IS_HTTP && dp.mod_http) {
|
||||||
LOG(LOG_S, "modify HTTP: n=%ld\n", n);
|
LOG(LOG_S, "modify HTTP: n=%zd\n", n);
|
||||||
if (mod_http(buffer, n, dp.mod_http)) {
|
if (mod_http(buffer, n, dp.mod_http)) {
|
||||||
LOG(LOG_E, "mod http error\n");
|
LOG(LOG_E, "mod http error\n");
|
||||||
return -1;
|
return -1;
|
||||||
@ -421,10 +421,10 @@ ssize_t desync(int sfd, char *buffer, size_t bfsize,
|
|||||||
}
|
}
|
||||||
if (!part_tls(buffer + lp,
|
if (!part_tls(buffer + lp,
|
||||||
bfsize - lp, n - lp, pos - lp)) {
|
bfsize - lp, n - lp, pos - lp)) {
|
||||||
LOG(LOG_E, "tlsrec error: pos=%ld, n=%ld\n", pos, n);
|
LOG(LOG_E, "tlsrec error: pos=%ld, n=%zd\n", pos, n);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
LOG(LOG_S, "tlsrec: pos=%ld, n=%ld\n", pos, n);
|
LOG(LOG_S, "tlsrec: pos=%ld, n=%zd\n", pos, n);
|
||||||
n += 5;
|
n += 5;
|
||||||
lp = pos + 5;
|
lp = pos + 5;
|
||||||
}
|
}
|
||||||
@ -463,7 +463,7 @@ ssize_t desync(int sfd, char *buffer, size_t bfsize,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (pos <= 0 || pos >= n || pos <= lp) {
|
else if (pos <= 0 || pos >= n || pos <= lp) {
|
||||||
LOG(LOG_E, "split cancel: pos=%ld-%ld, n=%ld\n", lp, pos, n);
|
LOG(LOG_E, "split cancel: pos=%ld-%ld, n=%zd\n", lp, pos, n);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// send part
|
// send part
|
||||||
@ -495,7 +495,7 @@ ssize_t desync(int sfd, char *buffer, size_t bfsize,
|
|||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
LOG(LOG_S, "split: pos=%ld-%ld (%ld), m: %s\n", lp, pos, s, demode_str[part.m]);
|
LOG(LOG_S, "split: pos=%ld-%ld (%zd), m: %s\n", lp, pos, s, demode_str[part.m]);
|
||||||
|
|
||||||
if (s < 0) {
|
if (s < 0) {
|
||||||
if (get_e() == EAGAIN) {
|
if (get_e() == EAGAIN) {
|
||||||
@ -504,14 +504,14 @@ ssize_t desync(int sfd, char *buffer, size_t bfsize,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else if (s != (pos - lp)) {
|
else if (s != (pos - lp)) {
|
||||||
LOG(LOG_E, "%ld != %ld\n", s, pos - lp);
|
LOG(LOG_E, "%zd != %ld\n", s, pos - lp);
|
||||||
return lp + s;
|
return lp + s;
|
||||||
}
|
}
|
||||||
lp = pos;
|
lp = pos;
|
||||||
}
|
}
|
||||||
// send all/rest
|
// send all/rest
|
||||||
if (lp < n) {
|
if (lp < n) {
|
||||||
LOG((lp ? LOG_S : LOG_L), "send: pos=%ld-%ld\n", lp, n);
|
LOG((lp ? LOG_S : LOG_L), "send: pos=%ld-%zd\n", lp, n);
|
||||||
if (send(sfd, buffer + lp, n - lp, 0) < 0) {
|
if (send(sfd, buffer + lp, n - lp, 0) < 0) {
|
||||||
if (get_e() == EAGAIN) {
|
if (get_e() == EAGAIN) {
|
||||||
return lp;
|
return lp;
|
||||||
|
6
proxy.c
6
proxy.c
@ -618,7 +618,7 @@ int on_tunnel(struct poolhd *pool, struct eval *val,
|
|||||||
}
|
}
|
||||||
sn = 0;
|
sn = 0;
|
||||||
}
|
}
|
||||||
LOG(LOG_S, "send: %ld != %ld (fd: %d)\n", sn, n, pair->fd);
|
LOG(LOG_S, "send: %zd != %zd (fd: %d)\n", sn, n, pair->fd);
|
||||||
assert(!(val->buff.size || val->buff.offset));
|
assert(!(val->buff.size || val->buff.offset));
|
||||||
|
|
||||||
val->buff.size = n - sn;
|
val->buff.size = n - sn;
|
||||||
@ -739,7 +739,7 @@ static inline int on_request(struct poolhd *pool, struct eval *val,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (n < S_SIZE_MIN) {
|
if (n < S_SIZE_MIN) {
|
||||||
LOG(LOG_E, "ss: request to small (%ld)\n", n);
|
LOG(LOG_E, "ss: request to small (%zd)\n", n);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
struct s5_req *r = (struct s5_req *)buffer;
|
struct s5_req *r = (struct s5_req *)buffer;
|
||||||
@ -781,7 +781,7 @@ static inline int on_request(struct poolhd *pool, struct eval *val,
|
|||||||
error = connect_hook(pool, val, &dst, EV_CONNECT);
|
error = connect_hook(pool, val, &dst, EV_CONNECT);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG(LOG_E, "ss: invalid version: 0x%x (%lu)\n", *buffer, n);
|
LOG(LOG_E, "ss: invalid version: 0x%x (%zd)\n", *buffer, n);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (error) {
|
if (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user