summaryrefslogtreecommitdiff
path: root/core/Lossless_UDP.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/Lossless_UDP.c')
-rw-r--r--core/Lossless_UDP.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/core/Lossless_UDP.c b/core/Lossless_UDP.c
index 15e8dea3..c30eb903 100644
--- a/core/Lossless_UDP.c
+++ b/core/Lossless_UDP.c
@@ -409,7 +409,7 @@ static int send_handshake(Lossless_UDP *ludp, IP_Port ip_port, uint32_t handshak
409 uint8_t packet[1 + 4 + 4]; 409 uint8_t packet[1 + 4 + 4];
410 uint32_t temp; 410 uint32_t temp;
411 411
412 packet[0] = 16; 412 packet[0] = NET_PACKET_HANDSHAKE;
413 temp = htonl(handshake_id1); 413 temp = htonl(handshake_id1);
414 memcpy(packet + 1, &temp, 4); 414 memcpy(packet + 1, &temp, 4);
415 temp = htonl(handshake_id2); 415 temp = htonl(handshake_id2);
@@ -431,7 +431,7 @@ static int send_SYNC(Lossless_UDP *ludp, uint32_t connection_id)
431 uint32_t requested[BUFFER_PACKET_NUM]; 431 uint32_t requested[BUFFER_PACKET_NUM];
432 uint32_t number = missing_packets(ludp, connection_id, requested); 432 uint32_t number = missing_packets(ludp, connection_id, requested);
433 433
434 packet[0] = 17; 434 packet[0] = NET_PACKET_SYNC;
435 index += 1; 435 index += 1;
436 memcpy(packet + index, &counter, 1); 436 memcpy(packet + index, &counter, 1);
437 index += 1; 437 index += 1;
@@ -450,7 +450,7 @@ static int send_data_packet(Lossless_UDP *ludp, uint32_t connection_id, uint32_t
450 uint32_t index = packet_num % MAX_QUEUE_NUM; 450 uint32_t index = packet_num % MAX_QUEUE_NUM;
451 uint32_t temp; 451 uint32_t temp;
452 uint8_t packet[1 + 4 + MAX_DATA_SIZE]; 452 uint8_t packet[1 + 4 + MAX_DATA_SIZE];
453 packet[0] = 18; 453 packet[0] = NET_PACKET_DATA;
454 temp = htonl(packet_num); 454 temp = htonl(packet_num);
455 memcpy(packet + 1, &temp, 4); 455 memcpy(packet + 1, &temp, 4);
456 memcpy(packet + 5, ludp->connections[connection_id].sendbuffer[index].data, 456 memcpy(packet + 5, ludp->connections[connection_id].sendbuffer[index].data,
@@ -733,9 +733,9 @@ Lossless_UDP *new_lossless_udp(Networking_Core *net)
733 return NULL; 733 return NULL;
734 734
735 temp->net = net; 735 temp->net = net;
736 networking_registerhandler(net, 16, &handle_handshake, temp); 736 networking_registerhandler(net, NET_PACKET_HANDSHAKE, &handle_handshake, temp);
737 networking_registerhandler(net, 17, &handle_SYNC, temp); 737 networking_registerhandler(net, NET_PACKET_SYNC, &handle_SYNC, temp);
738 networking_registerhandler(net, 18, &handle_data, temp); 738 networking_registerhandler(net, NET_PACKET_DATA, &handle_data, temp);
739 return temp; 739 return temp;
740} 740}
741 741
@@ -839,4 +839,4 @@ void kill_lossless_udp(Lossless_UDP *ludp)
839{ 839{
840 free(ludp->connections); 840 free(ludp->connections);
841 free(ludp); 841 free(ludp);
842} \ No newline at end of file 842}