From 0e3a2189f65354962fc71af41f5aa52261a782e8 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sun, 25 Oct 2026 22:30:04 +0100 Subject: Replace libowfat's iobatch with our own smaller (and probably only temporary) ot_batch --- proxy.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'proxy.c') diff --git a/proxy.c b/proxy.c index 219d926..63b4c4f 100644 --- a/proxy.c +++ b/proxy.c @@ -16,9 +16,9 @@ /* Libowfat */ #include "io.h" -#include "iob.h" /* Opentracker */ +#include "ot_batch.h" #include "ot_ip.h" #include "ot_mutex.h" #include "ot_random.h" @@ -228,7 +228,7 @@ typedef struct { size_t indata_length; /* Length of unprocessed data */ uint32_t tracker_id; /* How the other end greeted */ int64_t fd; /* A file handle, if connected, <= 0 is disconnected (0 initially, -1 else) */ - io_batch outdata; /* The iobatch containing our sync data */ + ot_batch outdata; /* The batch containing our sync data */ size_t packet_tcount; /* Number of unprocessed torrents in packet we currently receive */ uint8_t packet_tprefix; /* Prefix byte for all torrents in current packet */ @@ -243,7 +243,7 @@ void reset_info_block(proxy_peer *peer) { peer->tracker_id = 0; peer->fd = -1; peer->packet_tcount = 0; - iob_reset(&peer->outdata); + batch_reset(&peer->outdata); PROXYPEER_SETDISCONNECTED(peer->state); } @@ -424,11 +424,11 @@ static void handle_write(int64_t peersocket) { } break; case FLAG_CONNECTED: - switch (iob_send(peersocket, &peer->outdata)) { - case 0: /* all data sent */ + switch (batch_send(peersocket, &peer->outdata)) { + case BATCH_DONE: io_dontwantwrite(peersocket); break; - case -3: /* an error occured */ + case BATCH_FAILED: io_close(peersocket); reset_info_block(peer); break; @@ -728,7 +728,7 @@ static void *streamsync_worker(void *args) { void *tmp = malloc(mem); if (tmp) { memcpy(tmp, ptr, mem); - iob_addbuf_free(&g_connections[i].outdata, tmp, mem); + batch_add(&g_connections[i].outdata, tmp, mem); io_wantwrite(g_connections[i].fd); } } -- cgit v1.3