Pass along and use the actual port we're listening on for peers.exchange.
Some checks failed
Build Tilde Friends / Build-All (push) Failing after 4m5s
Some checks failed
Build Tilde Friends / Build-All (push) Failing after 4m5s
This commit is contained in:
@ -1429,8 +1429,13 @@ static void _tf_ssb_rpc_peers_exchange_internal(
|
||||
*dot = '\0';
|
||||
}
|
||||
|
||||
int port = tf_ssb_connection_get_port(connection);
|
||||
JSValue port_value = JS_GetPropertyStr(context, args, "port");
|
||||
JS_ToInt32(context, &port, port_value);
|
||||
JS_FreeValue(context, port_value);
|
||||
|
||||
char connection_string[1024] = { 0 };
|
||||
snprintf(connection_string, sizeof(connection_string), "net:%s:%d~shs:%s", tf_ssb_connection_get_host(connection), tf_ssb_connection_get_port(connection), fullid + 1);
|
||||
snprintf(connection_string, sizeof(connection_string), "net:%s:%d~shs:%s", tf_ssb_connection_get_host(connection), port, fullid + 1);
|
||||
tf_ssb_add_broadcast(ssb, connection_string, k_tf_ssb_broadcast_origin_peer_exchange, k_ssb_peer_exchange_expires_seconds);
|
||||
}
|
||||
|
||||
@ -1478,6 +1483,7 @@ static void _tf_ssb_rpc_send_peers_exchange(tf_ssb_connection_t* connection)
|
||||
JS_SetPropertyUint32(context, name, 1, JS_NewString(context, "exchange"));
|
||||
JS_SetPropertyStr(context, message, "name", name);
|
||||
tf_ssb_t* ssb = tf_ssb_connection_get_ssb(connection);
|
||||
JS_SetPropertyStr(context, message, "port", JS_NewInt32(context, tf_ssb_server_get_port(ssb)));
|
||||
JS_SetPropertyStr(context, message, "peers", _tf_ssb_get_peers_exchange(ssb));
|
||||
tf_ssb_connection_rpc_send_json(connection, k_ssb_rpc_flag_new_request, request_number, "peers.exchange", message, _tf_ssb_rpc_peers_exchange_internal, NULL, NULL);
|
||||
JS_FreeValue(context, message);
|
||||
|
Reference in New Issue
Block a user