ssb: Tidy up some of the more common reasons for disconnect.
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled
This commit is contained in:
@ -293,8 +293,28 @@ static void _tf_ssb_rpc_tunnel_callback(tf_ssb_connection_t* connection, uint8_t
|
||||
if (flags & k_ssb_rpc_flag_end_error)
|
||||
{
|
||||
tf_ssb_connection_remove_request(connection, request_number);
|
||||
|
||||
JSContext* context = tf_ssb_connection_get_context(connection);
|
||||
JSValue message_val = JS_GetPropertyStr(context, args, "message");
|
||||
JSValue stack_val = JS_GetPropertyStr(context, args, "stack");
|
||||
|
||||
char buffer[1024];
|
||||
snprintf(buffer, sizeof(buffer), "error from tunnel: %.*s", (int)size, message);
|
||||
if (!JS_IsUndefined(message_val))
|
||||
{
|
||||
const char* message_string = JS_ToCString(context, message_val);
|
||||
const char* stack_string = JS_ToCString(context, stack_val);
|
||||
snprintf(buffer, sizeof(buffer), "Error from tunnel: %s\n%s", message_string, stack_string);
|
||||
JS_FreeCString(context, message_string);
|
||||
JS_FreeCString(context, stack_string);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buffer, sizeof(buffer), "Error from tunnel: %.*s", (int)size, message);
|
||||
}
|
||||
|
||||
JS_FreeValue(context, stack_val);
|
||||
JS_FreeValue(context, message_val);
|
||||
|
||||
tf_ssb_connection_close(tun->connection, buffer);
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user