ssb: Refactoring EBT implementation. I think this works not worse than before and will let me schedule message replication better in a future change. #93
This commit is contained in:
11
src/ssb.c
11
src/ssb.c
@ -4,6 +4,7 @@
|
||||
#include "mem.h"
|
||||
#include "ssb.connections.h"
|
||||
#include "ssb.db.h"
|
||||
#include "ssb.ebt.h"
|
||||
#include "ssb.rpc.h"
|
||||
#include "trace.h"
|
||||
#include "util.js.h"
|
||||
@ -280,6 +281,7 @@ typedef struct _tf_ssb_connection_t
|
||||
tf_ssb_blob_wants_t blob_wants;
|
||||
bool sent_clock;
|
||||
int32_t ebt_request_number;
|
||||
tf_ssb_ebt_t* ebt;
|
||||
|
||||
JSValue object;
|
||||
|
||||
@ -1986,6 +1988,9 @@ static void _tf_ssb_connection_destroy(tf_ssb_connection_t* connection, const ch
|
||||
connection->message_requests = NULL;
|
||||
connection->message_requests_count = 0;
|
||||
|
||||
tf_ssb_ebt_destroy(connection->ebt);
|
||||
connection->ebt = NULL;
|
||||
|
||||
for (tf_ssb_connection_t** it = &connection->ssb->connections; *it; it = &(*it)->next)
|
||||
{
|
||||
if (*it == connection)
|
||||
@ -2744,6 +2749,7 @@ static tf_ssb_connection_t* _tf_ssb_connection_create_internal(tf_ssb_t* ssb, co
|
||||
connection->ssb = ssb;
|
||||
connection->send_request_number = 1;
|
||||
randombytes_buf(&connection->prng, sizeof(connection->prng));
|
||||
connection->ebt = tf_ssb_ebt_create(connection);
|
||||
|
||||
connection->async.data = connection;
|
||||
uv_async_init(ssb->loop, &connection->async, _tf_ssb_connection_process_message_async);
|
||||
@ -4341,3 +4347,8 @@ int tf_ssb_connection_get_flags(tf_ssb_connection_t* connection)
|
||||
{
|
||||
return connection->flags;
|
||||
}
|
||||
|
||||
tf_ssb_ebt_t* tf_ssb_connection_get_ebt(tf_ssb_connection_t* connection)
|
||||
{
|
||||
return connection ? connection->ebt : NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user