Minor cleanup.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4028 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
e49b54207a
commit
ae545e7b2b
@ -111,7 +111,7 @@ ssb.addEventListener('connections', function on_connections_changed(change, conn
|
||||
});
|
||||
} else {
|
||||
if (connection.is_client) {
|
||||
connection.send_json({'name': ['tunnel', 'isRoom'], 'args': [], 'type': 'source'}, function tunnel_is_room(request) {
|
||||
connection.send_json({'name': ['tunnel', 'isRoom'], 'args': []}, function tunnel_is_room(request) {
|
||||
if (request.message) {
|
||||
connection.send_json({'name': ['room', 'attendants'], 'args': [], 'type': 'source'}, tunnel_attendants);
|
||||
}
|
||||
@ -165,7 +165,7 @@ ssb.addEventListener('connections', function on_connections_changed(change, conn
|
||||
});
|
||||
|
||||
function blob_want_discovered(request, id) {
|
||||
if (Object.keys(request.connection.active_blob_wants).length > k_blobs_concurrent_target) {
|
||||
if (!request || !request.connection || Object.keys(request.connection.active_blob_wants).length > k_blobs_concurrent_target) {
|
||||
return;
|
||||
}
|
||||
var message = {};
|
||||
@ -181,6 +181,9 @@ function requestMoreBlobs(request) {
|
||||
row => blob_want_discovered(request, row.id));
|
||||
}
|
||||
|
||||
ssb.addRpc(['manifest'], function(request) {
|
||||
});
|
||||
|
||||
ssb.addRpc(['blobs', 'createWants'], function(request) {
|
||||
g_wants_requests[request.connection.id] = request;
|
||||
ssb.addEventListener('blob_want_added', id => blob_want_discovered(request, id));
|
||||
|
@ -2027,11 +2027,11 @@ tf_ssb_connection_t* tf_ssb_connection_create(tf_ssb_t* ssb, const char* host, c
|
||||
{
|
||||
for (tf_ssb_connection_t* connection = ssb->connections; connection; connection = connection->next)
|
||||
{
|
||||
if (memcmp(connection->serverpub, public_key, k_id_bin_len) == 0)
|
||||
if (memcmp(connection->serverpub, public_key, k_id_bin_len) == 0 && connection->state != k_tf_ssb_state_invalid)
|
||||
{
|
||||
char id[k_id_base64_len];
|
||||
tf_ssb_id_bin_to_str(id, sizeof(id), public_key);
|
||||
printf("Not connecting to %s:%d, because we are already connected to %s.\n", host, ntohs(addr->sin_port), id);
|
||||
printf("Not connecting to %s:%d, because we are already connected to %s (state = %d).\n", host, ntohs(addr->sin_port), id, connection->state);
|
||||
return NULL;
|
||||
}
|
||||
else if (memcmp(ssb->pub, public_key, k_id_bin_len) == 0)
|
||||
@ -2749,11 +2749,6 @@ JSClassID tf_ssb_get_connection_class_id()
|
||||
|
||||
JSValue tf_ssb_connection_get_object(tf_ssb_connection_t* connection)
|
||||
{
|
||||
if (connection && !JS_IsUndefined(connection->object))
|
||||
{
|
||||
JSRefCountHeader *p = (JSRefCountHeader *)JS_VALUE_GET_PTR(connection->object);
|
||||
printf("%p _get_object count=%d\nn", JS_VALUE_GET_PTR(connection->object), p->ref_count);
|
||||
}
|
||||
return connection ? connection->object : JS_UNDEFINED;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user