summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/DHT.c2
-rw-r--r--core/friend_requests.c32
2 files changed, 17 insertions, 17 deletions
diff --git a/core/DHT.c b/core/DHT.c
index b5224b8f..7e3af9d2 100644
--- a/core/DHT.c
+++ b/core/DHT.c
@@ -929,7 +929,7 @@ static int send_NATping(uint8_t * public_key, uint64_t ping_id, uint8_t type)
929 return num; 929 return num;
930} 930}
931 931
932/* Handle a recieved ping request for */ 932/* Handle a received ping request for */
933static int handle_NATping(uint8_t * packet, uint32_t length, IP_Port source) 933static int handle_NATping(uint8_t * packet, uint32_t length, IP_Port source)
934{ 934{
935 if (length < crypto_box_PUBLICKEYBYTES * 2 + crypto_box_NONCEBYTES + ENCRYPTION_PADDING 935 if (length < crypto_box_PUBLICKEYBYTES * 2 + crypto_box_NONCEBYTES + ENCRYPTION_PADDING
diff --git a/core/friend_requests.c b/core/friend_requests.c
index 5550b662..b8dab87e 100644
--- a/core/friend_requests.c
+++ b/core/friend_requests.c
@@ -68,32 +68,32 @@ void callback_friendrequest(void (*function)(uint8_t *, uint8_t *, uint16_t))
68} 68}
69 69
70 70
71/*NOTE: the following is just a temporary fix for the multiple friend requests recieved at the same time problem 71/*NOTE: the following is just a temporary fix for the multiple friend requests received at the same time problem
72 TODO: Make this better (This will most likely tie in with the way we will handle spam.)*/ 72 TODO: Make this better (This will most likely tie in with the way we will handle spam.)*/
73 73
74#define MAX_RECIEVED_STORED 32 74#define MAX_RECEIVED_STORED 32
75 75
76static uint8_t recieved_requests[MAX_RECIEVED_STORED][crypto_box_PUBLICKEYBYTES]; 76static uint8_t received_requests[MAX_RECEIVED_STORED][crypto_box_PUBLICKEYBYTES];
77static uint16_t recieved_requests_index; 77static uint16_t received_requests_index;
78 78
79/*Add to list of recieved friend requests*/ 79/*Add to list of received friend requests*/
80static void addto_recievedlist(uint8_t * client_id) 80static void addto_receivedlist(uint8_t * client_id)
81{ 81{
82 if (recieved_requests_index >= MAX_RECIEVED_STORED) 82 if (received_requests_index >= MAX_RECEIVED_STORED)
83 recieved_requests_index = 0; 83 received_requests_index = 0;
84 84
85 memcpy(recieved_requests[recieved_requests_index], client_id, crypto_box_PUBLICKEYBYTES); 85 memcpy(received_requests[received_requests_index], client_id, crypto_box_PUBLICKEYBYTES);
86 ++recieved_requests_index; 86 ++received_requests_index;
87} 87}
88 88
89/* Check if a friend request was already recieved 89/* Check if a friend request was already received
90 return 0 if not, 1 if we did */ 90 return 0 if not, 1 if we did */
91static int request_recieved(uint8_t * client_id) 91static int request_received(uint8_t * client_id)
92{ 92{
93 uint32_t i; 93 uint32_t i;
94 94
95 for (i = 0; i < MAX_RECIEVED_STORED; ++i) { 95 for (i = 0; i < MAX_RECEIVED_STORED; ++i) {
96 if (memcmp(recieved_requests[i], client_id, crypto_box_PUBLICKEYBYTES) == 0) 96 if (memcmp(received_requests[i], client_id, crypto_box_PUBLICKEYBYTES) == 0)
97 return 1; 97 return 1;
98 } 98 }
99 99
@@ -117,10 +117,10 @@ int friendreq_handlepacket(uint8_t * packet, uint32_t length, IP_Port source)
117 117
118 if (len == -1) 118 if (len == -1)
119 return 1; 119 return 1;
120 if (request_recieved(public_key)) 120 if (request_received(public_key))
121 return 1; 121 return 1;
122 122
123 addto_recievedlist(public_key); 123 addto_receivedlist(public_key);
124 (*handle_friendrequest)(public_key, data, len); 124 (*handle_friendrequest)(public_key, data, len);
125 } else { /* if request is not for us, try routing it. */ 125 } else { /* if request is not for us, try routing it. */
126 if(route_packet(packet + 1, packet, length) == length) 126 if(route_packet(packet + 1, packet, length) == length)