diff options
author | Christian Brueffer <christian@brueffer.de> | 2013-08-09 13:57:05 +0200 |
---|---|---|
committer | Christian Brueffer <christian@brueffer.de> | 2013-08-09 14:01:35 +0200 |
commit | 0b8fa729146c8033be161540289baa2244c94042 (patch) | |
tree | a3ed7b95ed09342402f37892ba2246436897e9d9 | |
parent | 29264b58fc58c5c22f301b9c2ed1a03eab78b310 (diff) |
Fix a recurring typo in code and comments.
-rwxr-xr-x | auto_tests/friends_test.c | 2 | ||||
-rw-r--r-- | auto_tests/messenger_test.c | 2 | ||||
-rw-r--r-- | core/DHT.c | 2 | ||||
-rw-r--r-- | core/friend_requests.c | 32 | ||||
-rw-r--r-- | testing/DHT_cryptosendfiletest.c | 4 | ||||
-rw-r--r-- | testing/Lossless_UDP_testclient.c | 2 | ||||
-rw-r--r-- | testing/Lossless_UDP_testserver.c | 10 | ||||
-rw-r--r-- | testing/Messenger_test.c | 6 | ||||
-rw-r--r-- | testing/rect.py | 6 |
9 files changed, 33 insertions, 33 deletions
diff --git a/auto_tests/friends_test.c b/auto_tests/friends_test.c index 11c6bf29..6c7569be 100755 --- a/auto_tests/friends_test.c +++ b/auto_tests/friends_test.c | |||
@@ -132,7 +132,7 @@ int parent_wait_for_message(void) | |||
132 | } | 132 | } |
133 | 133 | ||
134 | if(!(request_flags & SECOND_FLAG)) { | 134 | if(!(request_flags & SECOND_FLAG)) { |
135 | fputs("\nParent hasn't recieved the message yet!\n" | 135 | fputs("\nParent hasn't received the message yet!\n" |
136 | "Messaging may be broken, failing the build!\n", stderr); | 136 | "Messaging may be broken, failing the build!\n", stderr); |
137 | kill(child_pid, SIGKILL); | 137 | kill(child_pid, SIGKILL); |
138 | return -1; | 138 | return -1; |
diff --git a/auto_tests/messenger_test.c b/auto_tests/messenger_test.c index 4c5c29ad..af902083 100644 --- a/auto_tests/messenger_test.c +++ b/auto_tests/messenger_test.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * Note: | 8 | * Note: |
9 | * None of the functions here test things that rely on the network, i.e. | 9 | * None of the functions here test things that rely on the network, i.e. |
10 | * checking that status changes are recieved, messages can be sent, etc. | 10 | * checking that status changes are received, messages can be sent, etc. |
11 | * All of that is done in a separate test, with two local clients running. */ | 11 | * All of that is done in a separate test, with two local clients running. */ |
12 | 12 | ||
13 | #include "../core/Messenger.h" | 13 | #include "../core/Messenger.h" |
@@ -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 */ |
933 | static int handle_NATping(uint8_t * packet, uint32_t length, IP_Port source) | 933 | static 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 | ||
76 | static uint8_t recieved_requests[MAX_RECIEVED_STORED][crypto_box_PUBLICKEYBYTES]; | 76 | static uint8_t received_requests[MAX_RECEIVED_STORED][crypto_box_PUBLICKEYBYTES]; |
77 | static uint16_t recieved_requests_index; | 77 | static uint16_t received_requests_index; |
78 | 78 | ||
79 | /*Add to list of recieved friend requests*/ | 79 | /*Add to list of received friend requests*/ |
80 | static void addto_recievedlist(uint8_t * client_id) | 80 | static 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 */ |
91 | static int request_recieved(uint8_t * client_id) | 91 | static 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) |
diff --git a/testing/DHT_cryptosendfiletest.c b/testing/DHT_cryptosendfiletest.c index 888dac0f..7ebb72bf 100644 --- a/testing/DHT_cryptosendfiletest.c +++ b/testing/DHT_cryptosendfiletest.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* DHT cryptosendfiletest | 1 | /* DHT cryptosendfiletest |
2 | * | 2 | * |
3 | * This program sends or recieves a friend request. | 3 | * This program sends or receives a friend request. |
4 | * | 4 | * |
5 | * it also sends the encrypted data from a file to another client. | 5 | * it also sends the encrypted data from a file to another client. |
6 | * Receives the file data that that client sends us. | 6 | * Receives the file data that that client sends us. |
@@ -165,7 +165,7 @@ int main(int argc, char *argv[]) | |||
165 | } | 165 | } |
166 | } | 166 | } |
167 | if(handle_friendrequest(acceptedfriend_public_key, request_data) > 1) { | 167 | if(handle_friendrequest(acceptedfriend_public_key, request_data) > 1) { |
168 | printf("RECIEVED FRIEND REQUEST: %s\n", request_data); | 168 | printf("RECEIVED FRIEND REQUEST: %s\n", request_data); |
169 | } | 169 | } |
170 | 170 | ||
171 | /* if someone connected to us write what he sends to a file | 171 | /* if someone connected to us write what he sends to a file |
diff --git a/testing/Lossless_UDP_testclient.c b/testing/Lossless_UDP_testclient.c index 7093afec..78aff1a3 100644 --- a/testing/Lossless_UDP_testclient.c +++ b/testing/Lossless_UDP_testclient.c | |||
@@ -116,7 +116,7 @@ void printconnection(int connection_id) | |||
116 | } | 116 | } |
117 | */ | 117 | */ |
118 | 118 | ||
119 | /*( recieve packets and send them to the packethandler */ | 119 | /*( receive packets and send them to the packethandler */ |
120 | /*run doLossless_UDP(); */ | 120 | /*run doLossless_UDP(); */ |
121 | void Lossless_UDP() | 121 | void Lossless_UDP() |
122 | { | 122 | { |
diff --git a/testing/Lossless_UDP_testserver.c b/testing/Lossless_UDP_testserver.c index 84a64b38..f4b144b4 100644 --- a/testing/Lossless_UDP_testserver.c +++ b/testing/Lossless_UDP_testserver.c | |||
@@ -1,12 +1,12 @@ | |||
1 | /* Lossless_UDP testserver | 1 | /* Lossless_UDP testserver |
2 | * A program that waits for a lossless UDP connection and then saves all the data recieved to a file. | 2 | * A program that waits for a lossless UDP connection and then saves all the data received to a file. |
3 | * NOTE: this program simulates a 33% packet loss. | 3 | * NOTE: this program simulates a 33% packet loss. |
4 | * | 4 | * |
5 | * Best used in combination with Lossless_UDP_testclient | 5 | * Best used in combination with Lossless_UDP_testclient |
6 | * | 6 | * |
7 | * Compile with: gcc -O2 -Wall -lsodium -o testserver ../core/network.c ../core/Lossless_UDP.c Lossless_UDP_testserver.c | 7 | * Compile with: gcc -O2 -Wall -lsodium -o testserver ../core/network.c ../core/Lossless_UDP.c Lossless_UDP_testserver.c |
8 | * | 8 | * |
9 | * Command line argument is the name of the file to save what we recieve to. | 9 | * Command line argument is the name of the file to save what we receive to. |
10 | * EX: ./testserver filename1.txt | 10 | * EX: ./testserver filename1.txt |
11 | * | 11 | * |
12 | * Copyright (C) 2013 Tox project All Rights Reserved. | 12 | * Copyright (C) 2013 Tox project All Rights Reserved. |
@@ -113,7 +113,7 @@ void printconnection(int connection_id) | |||
113 | } | 113 | } |
114 | */ | 114 | */ |
115 | 115 | ||
116 | /* recieve packets and send them to the packethandler | 116 | /* receive packets and send them to the packethandler |
117 | * run doLossless_UDP(); */ | 117 | * run doLossless_UDP(); */ |
118 | void Lossless_UDP() | 118 | void Lossless_UDP() |
119 | { | 119 | { |
@@ -167,7 +167,7 @@ int main(int argc, char *argv[]) | |||
167 | connection = incoming_connection(); | 167 | connection = incoming_connection(); |
168 | if(connection != -1) { | 168 | if(connection != -1) { |
169 | if(is_connected(connection) == 2) { | 169 | if(is_connected(connection) == 2) { |
170 | printf("Recieved the connection.\n"); | 170 | printf("Received the connection.\n"); |
171 | 171 | ||
172 | } | 172 | } |
173 | break; | 173 | break; |
@@ -184,7 +184,7 @@ int main(int argc, char *argv[]) | |||
184 | kill_connection_in(connection, 3000000); | 184 | kill_connection_in(connection, 3000000); |
185 | read = read_packet(connection, buffer); | 185 | read = read_packet(connection, buffer); |
186 | if (read != 0) { | 186 | if (read != 0) { |
187 | // printf("Recieved data.\n"); | 187 | // printf("Received data.\n"); |
188 | if (!fwrite(buffer, read, 1, file)) | 188 | if (!fwrite(buffer, read, 1, file)) |
189 | printf("file write error\n"); | 189 | printf("file write error\n"); |
190 | } | 190 | } |
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c index 24a78abb..a11d374b 100644 --- a/testing/Messenger_test.c +++ b/testing/Messenger_test.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * It tries sending a message to the added friend. | 5 | * It tries sending a message to the added friend. |
6 | * | 6 | * |
7 | * If it recieves a message from a friend it replies back. | 7 | * If it receives a message from a friend it replies back. |
8 | * | 8 | * |
9 | * | 9 | * |
10 | * This is how I compile it: gcc -O2 -Wall -D VANILLA_NACL -o test ../core/Lossless_UDP.c ../core/network.c ../core/net_crypto.c ../core/Messenger.c ../core/DHT.c ../nacl/build/${HOSTNAME%.*}/lib/amd64/{cpucycles.o,libnacl.a,randombytes.o} Messenger_test.c | 10 | * This is how I compile it: gcc -O2 -Wall -D VANILLA_NACL -o test ../core/Lossless_UDP.c ../core/network.c ../core/net_crypto.c ../core/Messenger.c ../core/DHT.c ../nacl/build/${HOSTNAME%.*}/lib/amd64/{cpucycles.o,libnacl.a,randombytes.o} Messenger_test.c |
@@ -53,7 +53,7 @@ | |||
53 | 53 | ||
54 | void print_request(uint8_t * public_key, uint8_t * data, uint16_t length) | 54 | void print_request(uint8_t * public_key, uint8_t * data, uint16_t length) |
55 | { | 55 | { |
56 | printf("Friend request recieved from: \n"); | 56 | printf("Friend request received from: \n"); |
57 | printf("ClientID: "); | 57 | printf("ClientID: "); |
58 | uint32_t j; | 58 | uint32_t j; |
59 | for(j = 0; j < 32; j++) | 59 | for(j = 0; j < 32; j++) |
@@ -78,7 +78,7 @@ void print_request(uint8_t * public_key, uint8_t * data, uint16_t length) | |||
78 | 78 | ||
79 | void print_message(int friendnumber, uint8_t * string, uint16_t length) | 79 | void print_message(int friendnumber, uint8_t * string, uint16_t length) |
80 | { | 80 | { |
81 | printf("Message with length %u recieved from %u: %s \n", length, friendnumber, string); | 81 | printf("Message with length %u received from %u: %s \n", length, friendnumber, string); |
82 | m_sendmessage(friendnumber, (uint8_t*)"Test1", 6); | 82 | m_sendmessage(friendnumber, (uint8_t*)"Test1", 6); |
83 | } | 83 | } |
84 | 84 | ||
diff --git a/testing/rect.py b/testing/rect.py index 59d6c158..85e70810 100644 --- a/testing/rect.py +++ b/testing/rect.py | |||
@@ -18,17 +18,17 @@ a = 1; | |||
18 | #send ping request to our DHT on localhost. | 18 | #send ping request to our DHT on localhost. |
19 | sock.sendto("0012345678".decode("hex") + client_id, ('127.0.0.1', 33445)) | 19 | sock.sendto("0012345678".decode("hex") + client_id, ('127.0.0.1', 33445)) |
20 | 20 | ||
21 | #print all packets recieved and respond to ping requests properly | 21 | #print all packets received and respond to ping requests properly |
22 | while True: | 22 | while True: |
23 | data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes | 23 | data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes |
24 | print "received message:", data.encode('hex'), " From:", addr | 24 | print "received message:", data.encode('hex'), " From:", addr |
25 | #if we recieve a ping request. | 25 | #if we receive a ping request. |
26 | print data[0].encode('hex') | 26 | print data[0].encode('hex') |
27 | if data[0] == "00".decode('hex'): | 27 | if data[0] == "00".decode('hex'): |
28 | print "Sending ping resp" | 28 | print "Sending ping resp" |
29 | sock.sendto("01".decode('hex') + data[1:5] + client_id, addr) | 29 | sock.sendto("01".decode('hex') + data[1:5] + client_id, addr) |
30 | 30 | ||
31 | #if we recieve a get_nodes request. | 31 | #if we receive a get_nodes request. |
32 | if data[0] == "02".decode('hex'): | 32 | if data[0] == "02".decode('hex'): |
33 | print "Sending getn resp" | 33 | print "Sending getn resp" |
34 | #send send nodes packet with a couple 127.0.0.1 ips and ports. | 34 | #send send nodes packet with a couple 127.0.0.1 ips and ports. |