diff options
author | Test_User <hax@andrewyu.org> | 2024-06-19 03:59:17 -0400 |
---|---|---|
committer | Test_User <hax@andrewyu.org> | 2024-06-19 04:00:31 -0400 |
commit | 1fccd7a7bca5a980706b098d0b75f6c99edab63d (patch) | |
tree | 2ea3b51bc17b5b083a1f099bc7b804a7ea322662 | |
parent | 991d1d37474726ae5dc910da9705485f7b193e18 (diff) | |
download | haxircd-1fccd7a7bca5a980706b098d0b75f6c99edab63d.tar.gz haxircd-1fccd7a7bca5a980706b098d0b75f6c99edab63d.zip |
Don't send more than half the buffer at a time
-rw-r--r-- | networks/openssl_buffered.c | 2 | ||||
-rw-r--r-- | networks/plaintext_buffered.c | 2 | ||||
-rw-r--r-- | protocols/inspircd2.c | 18 |
3 files changed, 4 insertions, 18 deletions
diff --git a/networks/openssl_buffered.c b/networks/openssl_buffered.c index f929145..6959d33 100644 --- a/networks/openssl_buffered.c +++ b/networks/openssl_buffered.c @@ -124,6 +124,8 @@ void * openssl_buffered_send_thread(void *handle) { if (read_buffer_index + len > OPENSSL_BUFFERED_LEN) len = OPENSSL_BUFFERED_LEN - read_buffer_index; + if (len > OPENSSL_BUFFERED_LEN/2 && OPENSSL_BUFFERED_LEN > 1) + len = OPENSSL_BUFFERED_LEN/2; struct pollfd pollfd = { .fd = info->fd, diff --git a/networks/plaintext_buffered.c b/networks/plaintext_buffered.c index 99bd085..6f5016c 100644 --- a/networks/plaintext_buffered.c +++ b/networks/plaintext_buffered.c @@ -108,6 +108,8 @@ void * plaintext_buffered_send_thread(void *handle) { if (read_buffer_index + len > PLAINTEXT_BUFFERED_LEN) len = PLAINTEXT_BUFFERED_LEN - read_buffer_index; + if (len > PLAINTEXT_BUFFERED_LEN/2 && PLAINTEXT_BUFFERED_LEN > 1) + len = PLAINTEXT_BUFFERED_LEN/2; ssize_t res; do { diff --git a/protocols/inspircd2.c b/protocols/inspircd2.c index fb1873b..6541201 100644 --- a/protocols/inspircd2.c +++ b/protocols/inspircd2.c @@ -1027,8 +1027,6 @@ int inspircd2_protocol_init_handle_server(struct string source, size_t argc, str return -1; } - WRITES(2, STRING("0\n")); - if (source.len != 0) { WRITES(2, STRING("[InspIRCd v2] Server attempting to use a source without having introduced itself!\r\n")); return -1; @@ -1064,8 +1062,6 @@ int inspircd2_protocol_init_handle_server(struct string source, size_t argc, str networks[net].send(handle, STRING("\n")); } - WRITES(2, STRING("1\n")); - time_t now = time(0); if (now < 0) { WRITES(2, STRING("ERROR: Negative clock!\r\n")); @@ -1084,42 +1080,28 @@ int inspircd2_protocol_init_handle_server(struct string source, size_t argc, str networks[net].send(handle, time); networks[net].send(handle, STRING("\n")); - WRITES(2, STRING("2\n")); - inspircd2_protocol_introduce_servers_to(net, handle); - WRITES(2, STRING("3\n")); - for (size_t i = 0; i < user_list.len; i++) inspircd2_protocol_introduce_user_to(net, handle, user_list.array[i].ptr, 0); - WRITES(2, STRING("4\n")); - for (size_t i = 0; i < channel_list.len; i++) inspircd2_protocol_introduce_channel_to(net, handle, channel_list.array[i].ptr); - WRITES(2, STRING("5\n")); - networks[net].send(handle, STRING(":")); networks[net].send(handle, SID); networks[net].send(handle, STRING(" ENDBURST\n")); free(time.data); - WRITES(2, STRING("6\n")); - if (add_server((*config)->sid, SID, argv[3], argv[0], argv[4], INSPIRCD2_PROTOCOL, net, handle) != 0) { WRITES(2, STRING("ERROR: Unable to add server!\r\n")); return -1; } - WRITES(2, STRING("7\n")); - struct server_info *server = get_table_index(server_list, (*config)->sid); server->awaiting_pong = 0; - WRITES(2, STRING("8\n")); - return 1; } |