From e5425c0ffbbb730aaa838e46fe7e9633aa458107 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sat, 12 Aug 2023 19:57:00 +0000 Subject: [PATCH] Apparently the MUXRPC maximum segment size is 4096: https://github.com/ssbc/go-secretstream/blob/bd350c6f9e35528a121259c2a13ad32a20ea86d6/boxstream/box.go#L23. Reducing the send size seems to keep me connected to/through rooms longer. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4397 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/ssb.c | 4 ++-- src/ssb.rpc.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ssb.c b/src/ssb.c index c7da9419..9b4eb12b 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -545,7 +545,7 @@ static void _tf_ssb_nonce_inc(uint8_t* nonce) static void _tf_ssb_connection_box_stream_send(tf_ssb_connection_t* connection, const uint8_t* message, size_t size) { - const size_t k_send_max = 65535; + const size_t k_send_max = 4096; for (size_t offset = 0; offset < size; offset += k_send_max) { size_t send_size = size - offset > k_send_max ? k_send_max : size - offset; @@ -764,7 +764,7 @@ void tf_ssb_connection_rpc_send_error(tf_ssb_connection_t* connection, uint8_t f JS_SetPropertyStr(context, message, "name", JS_NewString(context, "Error")); JS_SetPropertyStr(context, message, "stack", JS_NewString(context, stack ? stack : "stack unavailable")); JS_SetPropertyStr(context, message, "message", JS_NewString(context, error)); - tf_ssb_connection_rpc_send_json(connection, ((flags & k_ssb_rpc_flag_stream) ? (k_ssb_rpc_flag_stream | k_ssb_rpc_flag_end_error) : 0), request_number, message, NULL, NULL, NULL); + tf_ssb_connection_rpc_send_json(connection, ((flags & k_ssb_rpc_flag_stream) ? (k_ssb_rpc_flag_stream) : 0) | k_ssb_rpc_flag_end_error, request_number, message, NULL, NULL, NULL); JS_FreeValue(context, message); tf_free((void*)stack); } diff --git a/src/ssb.rpc.c b/src/ssb.rpc.c index 2cc49646..2040047d 100644 --- a/src/ssb.rpc.c +++ b/src/ssb.rpc.c @@ -694,7 +694,9 @@ static void _tf_ssb_rpc_connection_room_attendants_callback(tf_ssb_connection_t* } else { - tf_ssb_connection_rpc_send_error(connection, flags, -request_number, "Unexpected room.attendants response type."); + char buffer[256]; + snprintf(buffer, sizeof(buffer), "Unexpected room.attendants response type: '%s'.", type_string); + tf_ssb_connection_rpc_send_error(connection, flags, -request_number, buffer); } JS_FreeCString(context, type_string); JS_FreeValue(context, type);