diff options
| author | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-23 22:10:58 +0200 |
|---|---|---|
| committer | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-23 22:10:58 +0200 |
| commit | 280344488f09ff29deb052dfa94ed74668c00b18 (patch) | |
| tree | 4d4ce5abeabe0ad34e9d91f6c8e8637a4d8ed23a | |
| parent | de67a4a721c0fda9a9b5955f235baafba9ba393d (diff) | |
Remove last byte_diff and provide more prototypes
| -rw-r--r-- | ot_livesync.c | 6 | ||||
| -rw-r--r-- | ot_livesync.h | 6 | ||||
| -rw-r--r-- | ot_sync.c | 9 |
3 files changed, 10 insertions, 11 deletions
diff --git a/ot_livesync.c b/ot_livesync.c index f620592..efba4d7 100644 --- a/ot_livesync.c +++ b/ot_livesync.c | |||
| @@ -57,7 +57,7 @@ static sync_buffer g_v6_buf; | |||
| 57 | static sync_buffer g_v4_buf; | 57 | static sync_buffer g_v4_buf; |
| 58 | 58 | ||
| 59 | static pthread_t thread_id; | 59 | static pthread_t thread_id; |
| 60 | void livesync_init() { | 60 | void livesync_init(void) { |
| 61 | 61 | ||
| 62 | if (g_socket_in == -1) | 62 | if (g_socket_in == -1) |
| 63 | exerr("No socket address for live sync specified."); | 63 | exerr("No socket address for live sync specified."); |
| @@ -78,7 +78,7 @@ void livesync_init() { | |||
| 78 | pthread_create(&thread_id, NULL, livesync_worker, NULL); | 78 | pthread_create(&thread_id, NULL, livesync_worker, NULL); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | void livesync_deinit() { | 81 | void livesync_deinit(void) { |
| 82 | if (g_socket_in != -1) | 82 | if (g_socket_in != -1) |
| 83 | close(g_socket_in); | 83 | close(g_socket_in); |
| 84 | if (g_socket_out != -1) | 84 | if (g_socket_out != -1) |
| @@ -167,7 +167,7 @@ static void livesync_handle_peersync(struct ot_workstruct *ws, size_t peer_size) | |||
| 167 | /* Tickle the live sync module from time to time, so no events get | 167 | /* Tickle the live sync module from time to time, so no events get |
| 168 | stuck when there's not enough traffic to fill udp packets fast | 168 | stuck when there's not enough traffic to fill udp packets fast |
| 169 | enough */ | 169 | enough */ |
| 170 | void livesync_ticker() { | 170 | void livesync_ticker(void) { |
| 171 | /* livesync_issue_peersync sets g_next_packet_time */ | 171 | /* livesync_issue_peersync sets g_next_packet_time */ |
| 172 | pthread_mutex_lock(&g_outbuf_mutex); | 172 | pthread_mutex_lock(&g_outbuf_mutex); |
| 173 | if (g_now_seconds > g_v6_buf.next_packet_time && g_v6_buf.fill > sizeof(g_tracker_id) + sizeof(uint32_t)) | 173 | if (g_now_seconds > g_v6_buf.next_packet_time && g_v6_buf.fill > sizeof(g_tracker_id) + sizeof(uint32_t)) |
diff --git a/ot_livesync.h b/ot_livesync.h index cb28774..ed710f0 100644 --- a/ot_livesync.h +++ b/ot_livesync.h | |||
| @@ -47,8 +47,8 @@ | |||
| 47 | 47 | ||
| 48 | #define LIVESYNC_PORT 9696 | 48 | #define LIVESYNC_PORT 9696 |
| 49 | 49 | ||
| 50 | void livesync_init(); | 50 | void livesync_init(void); |
| 51 | void livesync_deinit(); | 51 | void livesync_deinit(void); |
| 52 | 52 | ||
| 53 | /* Join multicast group for listening and create sending socket */ | 53 | /* Join multicast group for listening and create sending socket */ |
| 54 | void livesync_bind_mcast(char *ip, uint16_t port); | 54 | void livesync_bind_mcast(char *ip, uint16_t port); |
| @@ -59,7 +59,7 @@ void livesync_tell(struct ot_workstruct *ws); | |||
| 59 | /* Tickle the live sync module from time to time, so no events get | 59 | /* Tickle the live sync module from time to time, so no events get |
| 60 | stuck when there's not enough traffic to fill udp packets fast | 60 | stuck when there's not enough traffic to fill udp packets fast |
| 61 | enough */ | 61 | enough */ |
| 62 | void livesync_ticker(); | 62 | void livesync_ticker(void); |
| 63 | 63 | ||
| 64 | /* Handle an incoming live sync packet */ | 64 | /* Handle an incoming live sync packet */ |
| 65 | void handle_livesync(const int64 sock); | 65 | void handle_livesync(const int64 sock); |
| @@ -12,7 +12,6 @@ | |||
| 12 | #include <sys/uio.h> | 12 | #include <sys/uio.h> |
| 13 | 13 | ||
| 14 | /* Libowfat */ | 14 | /* Libowfat */ |
| 15 | #include "byte.h" | ||
| 16 | #include "io.h" | 15 | #include "io.h" |
| 17 | #include "scan.h" | 16 | #include "scan.h" |
| 18 | 17 | ||
| @@ -36,15 +35,15 @@ int add_changeset_to_tracker(uint8_t *data, size_t len) { | |||
| 36 | uint8_t *end = data + len; | 35 | uint8_t *end = data + len; |
| 37 | unsigned long peer_count; | 36 | unsigned long peer_count; |
| 38 | 37 | ||
| 39 | /* We do know, that the string is \n terminated, so it cant | 38 | /* We do know, that the string is \n terminated, so it can't |
| 40 | overflow */ | 39 | overflow */ |
| 41 | if (byte_diff(data, 8, "d4:syncd")) | 40 | if (!memcmp(data, "d4:syncd", 8)) |
| 42 | return -1; | 41 | return -1; |
| 43 | data += 8; | 42 | data += 8; |
| 44 | 43 | ||
| 45 | while (1) { | 44 | while (1) { |
| 46 | if (byte_diff(data, 3, "20:")) { | 45 | if (!memcmp(data, "20:", 3)) { |
| 47 | if (byte_diff(data, 2, "ee")) | 46 | if (!memcmp(data, "ee", 2)) |
| 48 | return -1; | 47 | return -1; |
| 49 | return 0; | 48 | return 0; |
| 50 | } | 49 | } |
