diff options
Diffstat (limited to 'core/DHT.c')
-rw-r--r-- | core/DHT.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -482,7 +482,7 @@ static int getnodes(DHT *dht, IP_Port ip_port, uint8_t *public_key, uint8_t *cli | |||
482 | if (len != sizeof(ping_id) + CLIENT_ID_SIZE + ENCRYPTION_PADDING) | 482 | if (len != sizeof(ping_id) + CLIENT_ID_SIZE + ENCRYPTION_PADDING) |
483 | return -1; | 483 | return -1; |
484 | 484 | ||
485 | data[0] = 2; | 485 | data[0] = NET_PACKET_GET_NODES; |
486 | memcpy(data + 1, dht->c->self_public_key, CLIENT_ID_SIZE); | 486 | memcpy(data + 1, dht->c->self_public_key, CLIENT_ID_SIZE); |
487 | memcpy(data + 1 + CLIENT_ID_SIZE, nonce, crypto_box_NONCEBYTES); | 487 | memcpy(data + 1 + CLIENT_ID_SIZE, nonce, crypto_box_NONCEBYTES); |
488 | memcpy(data + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES, encrypt, len); | 488 | memcpy(data + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES, encrypt, len); |
@@ -524,7 +524,7 @@ static int sendnodes(DHT *dht, IP_Port ip_port, uint8_t *public_key, uint8_t *cl | |||
524 | if (len != sizeof(ping_id) + num_nodes * sizeof(Node_format) + ENCRYPTION_PADDING) | 524 | if (len != sizeof(ping_id) + num_nodes * sizeof(Node_format) + ENCRYPTION_PADDING) |
525 | return -1; | 525 | return -1; |
526 | 526 | ||
527 | data[0] = 3; | 527 | data[0] = NET_PACKET_SEND_NODES; |
528 | memcpy(data + 1, dht->c->self_public_key, CLIENT_ID_SIZE); | 528 | memcpy(data + 1, dht->c->self_public_key, CLIENT_ID_SIZE); |
529 | memcpy(data + 1 + CLIENT_ID_SIZE, nonce, crypto_box_NONCEBYTES); | 529 | memcpy(data + 1 + CLIENT_ID_SIZE, nonce, crypto_box_NONCEBYTES); |
530 | memcpy(data + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES, encrypt, len); | 530 | memcpy(data + 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES, encrypt, len); |
@@ -1162,10 +1162,10 @@ DHT *new_DHT(Net_Crypto *c) | |||
1162 | } | 1162 | } |
1163 | 1163 | ||
1164 | temp->c = c; | 1164 | temp->c = c; |
1165 | networking_registerhandler(c->lossless_udp->net, 0, &handle_ping_request, temp); | 1165 | networking_registerhandler(c->lossless_udp->net, NET_PACKET_PING_REQUEST, &handle_ping_request, temp); |
1166 | networking_registerhandler(c->lossless_udp->net, 1, &handle_ping_response, temp); | 1166 | networking_registerhandler(c->lossless_udp->net, NET_PACKET_PING_RESPONSE, &handle_ping_response, temp); |
1167 | networking_registerhandler(c->lossless_udp->net, 2, &handle_getnodes, temp); | 1167 | networking_registerhandler(c->lossless_udp->net, NET_PACKET_GET_NODES, &handle_getnodes, temp); |
1168 | networking_registerhandler(c->lossless_udp->net, 3, &handle_sendnodes, temp); | 1168 | networking_registerhandler(c->lossless_udp->net, NET_PACKET_SEND_NODES, &handle_sendnodes, temp); |
1169 | cryptopacket_registerhandler(c, 254, &handle_NATping, temp); | 1169 | cryptopacket_registerhandler(c, 254, &handle_NATping, temp); |
1170 | return temp; | 1170 | return temp; |
1171 | } | 1171 | } |