-bool send_req_key(node_t *to) {
- if(to->status.sptps) {
- if(!node_read_ecdsa_public_key(to)) {
- logger(DEBUG_PROTOCOL, LOG_DEBUG, "No ECDSA key known for %s (%s)", to->name, to->hostname);
- send_request(to->nexthop->connection, "%d %s %s %d", REQ_KEY, myself->name, to->name, REQ_PUBKEY);
- return true;
- }
- char label[25 + strlen(myself->name) + strlen(to->name)];
- snprintf(label, sizeof label, "tinc UDP key expansion %s %s", myself->name, to->name);
- sptps_stop(&to->sptps);
- to->status.validkey = false;
- to->status.waitingforkey = true;
- to->last_req_key = time(NULL);
- to->incompression = myself->incompression;
- return sptps_start(&to->sptps, to, true, true, myself->connection->ecdsa, to->ecdsa, label, sizeof label, send_initial_sptps_data, receive_sptps_record);
+bool send_req_key(meshlink_handle_t *mesh, node_t *to) {
+ if(!node_read_public_key(mesh, to)) {
+ logger(mesh, MESHLINK_DEBUG, "No ECDSA key known for %s", to->name);
+ send_request(mesh, to->nexthop->connection, NULL, "%d %s %s %d", REQ_KEY, mesh->self->name, to->name, REQ_PUBKEY);
+ return true;
+ }
+
+ if(to->sptps.label) {
+ logger(mesh, MESHLINK_DEBUG, "send_req_key(%s) called while sptps->label != NULL!", to->name);