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.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/Lossless_UDP.c b/core/Lossless_UDP.c
index b249760a..080dc821 100644
--- a/core/Lossless_UDP.c
+++ b/core/Lossless_UDP.c
@@ -27,7 +27,7 @@
27 27
28 28
29 29
30//maximum data packets in sent and recieve queues. 30//maximum data packets in sent and receive queues.
31#define MAX_QUEUE_NUM 16 31#define MAX_QUEUE_NUM 16
32 32
33//maximum length of the data in the data packets 33//maximum length of the data in the data packets
@@ -66,14 +66,14 @@ typedef struct
66 uint16_t data_rate;//current data packet send rate packets per second. 66 uint16_t data_rate;//current data packet send rate packets per second.
67 uint64_t last_SYNC; //time at which our last SYNC packet was sent. 67 uint64_t last_SYNC; //time at which our last SYNC packet was sent.
68 uint64_t last_sent; //time at which our last data or handshake packet was sent. 68 uint64_t last_sent; //time at which our last data or handshake packet was sent.
69 uint64_t last_recv; //time at which we last recieved something from the other 69 uint64_t last_recv; //time at which we last received something from the other
70 uint64_t killat; //time at which to kill the connection 70 uint64_t killat; //time at which to kill the connection
71 Data sendbuffer[MAX_QUEUE_NUM];//packet send buffer. 71 Data sendbuffer[MAX_QUEUE_NUM];//packet send buffer.
72 Data recvbuffer[MAX_QUEUE_NUM];//packet recieve buffer. 72 Data recvbuffer[MAX_QUEUE_NUM];//packet receive buffer.
73 uint32_t handshake_id1; 73 uint32_t handshake_id1;
74 uint32_t handshake_id2; 74 uint32_t handshake_id2;
75 uint32_t recv_packetnum; //number of data packets recieved (also used as handshake_id1) 75 uint32_t recv_packetnum; //number of data packets received (also used as handshake_id1)
76 uint32_t orecv_packetnum; //number of packets recieved by the other peer 76 uint32_t orecv_packetnum; //number of packets received by the other peer
77 uint32_t sent_packetnum; //number of data packets sent 77 uint32_t sent_packetnum; //number of data packets sent
78 uint32_t osent_packetnum; //number of packets sent by the other peer. 78 uint32_t osent_packetnum; //number of packets sent by the other peer.
79 uint32_t sendbuff_packetnum; //number of latest packet written onto the sendbuffer 79 uint32_t sendbuff_packetnum; //number of latest packet written onto the sendbuffer
@@ -250,7 +250,7 @@ int kill_connection_in(int connection_id, uint32_t seconds)
250//return 1 if attempting handshake 250//return 1 if attempting handshake
251//return 2 if handshake is done 251//return 2 if handshake is done
252//return 3 if fully connected 252//return 3 if fully connected
253//return 4 if timed out and wating to be killed 253//return 4 if timed out and waiting to be killed
254int is_connected(int connection_id) 254int is_connected(int connection_id)
255{ 255{
256 if(connection_id >= 0 && connection_id < MAX_CONNECTIONS) 256 if(connection_id >= 0 && connection_id < MAX_CONNECTIONS)
@@ -450,7 +450,7 @@ int send_DATA(uint32_t connection_id)
450 450
451 451
452//Packet handling functions 452//Packet handling functions
453//One to handle each type of packets we recieve 453//One to handle each type of packets we receive
454//return 0 if handled correctly, 1 if packet is bad. 454//return 0 if handled correctly, 1 if packet is bad.
455int handle_handshake(uint8_t * packet, uint32_t length, IP_Port source) 455int handle_handshake(uint8_t * packet, uint32_t length, IP_Port source)
456{ 456{
@@ -607,7 +607,7 @@ int handle_SYNC(uint8_t * packet, uint32_t length, IP_Port source)
607 return 0; 607 return 0;
608} 608}
609 609
610//add a packet to the recieved buffer and set the recv_packetnum of the connection to its proper value. 610//add a packet to the received buffer and set the recv_packetnum of the connection to its proper value.
611//return 1 if data was too big, 0 if not. 611//return 1 if data was too big, 0 if not.
612int add_recv(int connection_id, uint32_t data_num, uint8_t * data, uint16_t size) 612int add_recv(int connection_id, uint32_t data_num, uint8_t * data, uint16_t size)
613{ 613{