X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fnet_socket.c;h=c6fc124261101053ae3e756deb47ccb18b87a587;hb=2cfd1205dc9c6e9d42cc569f415afe13f52357ec;hp=a6adb2a61a6cb75f3dc5e833e88d76af6ae0eeec;hpb=3268e9a2b9fea6779224fe1f3da48b7fc4b9cb46;p=meshlink diff --git a/src/net_socket.c b/src/net_socket.c index a6adb2a6..c6fc1242 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -43,8 +43,6 @@ int max_connection_burst = 100; /* Setup sockets */ static void configure_tcp(connection_t *c) { - int option; - #ifdef O_NONBLOCK int flags = fcntl(c->socket, F_GETFL); @@ -102,7 +100,6 @@ int setup_listen_socket(const sockaddr_t *sa) { int nfd; char *addrstr; int option; - char *iface; nfd = socket(sa->sa.sa_family, SOCK_STREAM, IPPROTO_TCP); @@ -255,7 +252,7 @@ void finish_connecting(meshlink_handle_t *mesh, connection_t *c) { c->last_ping_time = mesh->loop.now.tv_sec; c->status.connecting = false; - send_id(c); + send_id(mesh, c); } static void do_outgoing_pipe(meshlink_handle_t *mesh, connection_t *c, char *command) { @@ -465,7 +462,7 @@ begin: c->outcompression = mesh->self->connection->outcompression; c->last_ping_time = mesh->loop.now.tv_sec; - connection_add(c); + connection_add(mesh, c); io_add(&mesh->loop, &c->io, handle_meta_io, c, c->socket, IO_READ|IO_WRITE); @@ -508,7 +505,7 @@ static struct addrinfo *get_known_addresses(node_t *n) { void setup_outgoing_connection(meshlink_handle_t *mesh, outgoing_t *outgoing) { timeout_del(&mesh->loop, &outgoing->ev); - node_t *n = lookup_node(outgoing->name); + node_t *n = lookup_node(mesh, outgoing->name); if(n && n->connection) { logger(DEBUG_CONNECTIONS, LOG_INFO, "Already connected to %s", outgoing->name); @@ -620,10 +617,10 @@ void handle_new_meta_connection(event_loop_t *loop, void *data, int flags) { configure_tcp(c); - connection_add(c); + connection_add(mesh, c); c->allow_request = ID; - send_id(c); + send_id(mesh, c); } static void free_outgoing(meshlink_handle_t *mesh, outgoing_t *outgoing) {