diff options
| author | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-25 22:30:04 +0100 |
|---|---|---|
| committer | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-25 22:30:04 +0100 |
| commit | 0e3a2189f65354962fc71af41f5aa52261a782e8 (patch) | |
| tree | eae9ec0a8930ae7cc2de02b9ed1d797bfbc2e6e8 /proxy.c | |
| parent | 3f7d4f4e8bc8cd9928fd0b1b280eb4c3f0ca9fa5 (diff) | |
Replace libowfat's iobatch with our own smaller (and probably only temporary) ot_batch
Diffstat (limited to 'proxy.c')
| -rw-r--r-- | proxy.c | 14 |
1 files changed, 7 insertions, 7 deletions
| @@ -16,9 +16,9 @@ | |||
| 16 | 16 | ||
| 17 | /* Libowfat */ | 17 | /* Libowfat */ |
| 18 | #include "io.h" | 18 | #include "io.h" |
| 19 | #include "iob.h" | ||
| 20 | 19 | ||
| 21 | /* Opentracker */ | 20 | /* Opentracker */ |
| 21 | #include "ot_batch.h" | ||
| 22 | #include "ot_ip.h" | 22 | #include "ot_ip.h" |
| 23 | #include "ot_mutex.h" | 23 | #include "ot_mutex.h" |
| 24 | #include "ot_random.h" | 24 | #include "ot_random.h" |
| @@ -228,7 +228,7 @@ typedef struct { | |||
| 228 | size_t indata_length; /* Length of unprocessed data */ | 228 | size_t indata_length; /* Length of unprocessed data */ |
| 229 | uint32_t tracker_id; /* How the other end greeted */ | 229 | uint32_t tracker_id; /* How the other end greeted */ |
| 230 | int64_t fd; /* A file handle, if connected, <= 0 is disconnected (0 initially, -1 else) */ | 230 | int64_t fd; /* A file handle, if connected, <= 0 is disconnected (0 initially, -1 else) */ |
| 231 | io_batch outdata; /* The iobatch containing our sync data */ | 231 | ot_batch outdata; /* The batch containing our sync data */ |
| 232 | 232 | ||
| 233 | size_t packet_tcount; /* Number of unprocessed torrents in packet we currently receive */ | 233 | size_t packet_tcount; /* Number of unprocessed torrents in packet we currently receive */ |
| 234 | uint8_t packet_tprefix; /* Prefix byte for all torrents in current packet */ | 234 | uint8_t packet_tprefix; /* Prefix byte for all torrents in current packet */ |
| @@ -243,7 +243,7 @@ void reset_info_block(proxy_peer *peer) { | |||
| 243 | peer->tracker_id = 0; | 243 | peer->tracker_id = 0; |
| 244 | peer->fd = -1; | 244 | peer->fd = -1; |
| 245 | peer->packet_tcount = 0; | 245 | peer->packet_tcount = 0; |
| 246 | iob_reset(&peer->outdata); | 246 | batch_reset(&peer->outdata); |
| 247 | PROXYPEER_SETDISCONNECTED(peer->state); | 247 | PROXYPEER_SETDISCONNECTED(peer->state); |
| 248 | } | 248 | } |
| 249 | 249 | ||
| @@ -424,11 +424,11 @@ static void handle_write(int64_t peersocket) { | |||
| 424 | } | 424 | } |
| 425 | break; | 425 | break; |
| 426 | case FLAG_CONNECTED: | 426 | case FLAG_CONNECTED: |
| 427 | switch (iob_send(peersocket, &peer->outdata)) { | 427 | switch (batch_send(peersocket, &peer->outdata)) { |
| 428 | case 0: /* all data sent */ | 428 | case BATCH_DONE: |
| 429 | io_dontwantwrite(peersocket); | 429 | io_dontwantwrite(peersocket); |
| 430 | break; | 430 | break; |
| 431 | case -3: /* an error occured */ | 431 | case BATCH_FAILED: |
| 432 | io_close(peersocket); | 432 | io_close(peersocket); |
| 433 | reset_info_block(peer); | 433 | reset_info_block(peer); |
| 434 | break; | 434 | break; |
| @@ -728,7 +728,7 @@ static void *streamsync_worker(void *args) { | |||
| 728 | void *tmp = malloc(mem); | 728 | void *tmp = malloc(mem); |
| 729 | if (tmp) { | 729 | if (tmp) { |
| 730 | memcpy(tmp, ptr, mem); | 730 | memcpy(tmp, ptr, mem); |
| 731 | iob_addbuf_free(&g_connections[i].outdata, tmp, mem); | 731 | batch_add(&g_connections[i].outdata, tmp, mem); |
| 732 | io_wantwrite(g_connections[i].fd); | 732 | io_wantwrite(g_connections[i].fd); |
| 733 | } | 733 | } |
| 734 | } | 734 | } |
