From 0cf5dfc6a3725b6ae34eccf8792a547d251b2af1 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Mon, 2 Nov 2026 12:11:09 +0300 Subject: [PATCH] Windows: the loop's socket results in the type the socket calls return ssize_t does not exist under MSVC, and the socket function table already spells its send and recv results int there and ssize_t elsewhere. That type is now named SOCKRET, beside SASIZETYPE, and the event loop's copies of it use the name, so the MSVC build compiles again. --- src/mainloop.c | 4 ++-- src/proxy.h | 1 + src/structures.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mainloop.c b/src/mainloop.c index e5ad7c1..2a0b40e 100644 --- a/src/mainloop.c +++ b/src/mainloop.c @@ -555,7 +555,7 @@ static void cbfail(struct cbmap *m, int side, int writing){ /* Statistics of what went through a way, as sockmap() counts them, and the bandwidth limits' pause: the client's data once written to the server, the server's once read. A read counts for the grace. */ -static void cbcount(struct cbmap *m, struct cbway *w, int written, ssize_t n){ +static void cbcount(struct cbmap *m, struct cbway *w, int written, SOCKRET n){ struct clientparam *param = m->param; int sl = 0; @@ -603,7 +603,7 @@ static int cbway(struct cbmap *m, struct cbway *w){ unsigned char *buf; unsigned *inbuf, *offset, size; uint64_t inb, room; - ssize_t n; + SOCKRET n; if(!w->left) return 0; cbbuf(param, w->src, &buf, &inbuf, &offset, &size); diff --git a/src/proxy.h b/src/proxy.h index db9dc1a..85750bf 100644 --- a/src/proxy.h +++ b/src/proxy.h @@ -62,6 +62,7 @@ #include #include #define SASIZETYPE int +#define SOCKRET int /* what a socket call returns: moved bytes or -1 */ #define SHUT_RDWR SD_BOTH #define SHUT_WR SD_SEND #define SHUT_RD SD_RECEIVE diff --git a/src/structures.h b/src/structures.h index e375afe..548a89a 100644 --- a/src/structures.h +++ b/src/structures.h @@ -35,6 +35,7 @@ extern "C" { #include #endif #define SASIZETYPE socklen_t +#define SOCKRET ssize_t /* what a socket call returns: moved bytes or -1 */ #define SOCKET int #define INVALID_SOCKET (-1) #define _3proxy_mutex_t pthread_mutex_t