Fix a recurring typo in code and comments.

This commit is contained in:
Christian Brueffer 2013-08-09 13:57:05 +02:00
parent 29264b58fc
commit 0b8fa72914
9 changed files with 33 additions and 33 deletions

View File

@ -132,7 +132,7 @@ int parent_wait_for_message(void)
} }
if(!(request_flags & SECOND_FLAG)) { if(!(request_flags & SECOND_FLAG)) {
fputs("\nParent hasn't recieved the message yet!\n" fputs("\nParent hasn't received the message yet!\n"
"Messaging may be broken, failing the build!\n", stderr); "Messaging may be broken, failing the build!\n", stderr);
kill(child_pid, SIGKILL); kill(child_pid, SIGKILL);
return -1; return -1;

View File

@ -7,7 +7,7 @@
* *
* Note: * Note:
* None of the functions here test things that rely on the network, i.e. * None of the functions here test things that rely on the network, i.e.
* checking that status changes are recieved, messages can be sent, etc. * checking that status changes are received, messages can be sent, etc.
* All of that is done in a separate test, with two local clients running. */ * All of that is done in a separate test, with two local clients running. */
#include "../core/Messenger.h" #include "../core/Messenger.h"

View File

@ -929,7 +929,7 @@ static int send_NATping(uint8_t * public_key, uint64_t ping_id, uint8_t type)
return num; return num;
} }
/* Handle a recieved ping request for */ /* Handle a received ping request for */
static int handle_NATping(uint8_t * packet, uint32_t length, IP_Port source) static int handle_NATping(uint8_t * packet, uint32_t length, IP_Port source)
{ {
if (length < crypto_box_PUBLICKEYBYTES * 2 + crypto_box_NONCEBYTES + ENCRYPTION_PADDING if (length < crypto_box_PUBLICKEYBYTES * 2 + crypto_box_NONCEBYTES + ENCRYPTION_PADDING

View File

@ -68,32 +68,32 @@ void callback_friendrequest(void (*function)(uint8_t *, uint8_t *, uint16_t))
} }
/*NOTE: the following is just a temporary fix for the multiple friend requests recieved at the same time problem /*NOTE: the following is just a temporary fix for the multiple friend requests received at the same time problem
TODO: Make this better (This will most likely tie in with the way we will handle spam.)*/ TODO: Make this better (This will most likely tie in with the way we will handle spam.)*/
#define MAX_RECIEVED_STORED 32 #define MAX_RECEIVED_STORED 32
static uint8_t recieved_requests[MAX_RECIEVED_STORED][crypto_box_PUBLICKEYBYTES]; static uint8_t received_requests[MAX_RECEIVED_STORED][crypto_box_PUBLICKEYBYTES];
static uint16_t recieved_requests_index; static uint16_t received_requests_index;
/*Add to list of recieved friend requests*/ /*Add to list of received friend requests*/
static void addto_recievedlist(uint8_t * client_id) static void addto_receivedlist(uint8_t * client_id)
{ {
if (recieved_requests_index >= MAX_RECIEVED_STORED) if (received_requests_index >= MAX_RECEIVED_STORED)
recieved_requests_index = 0; received_requests_index = 0;
memcpy(recieved_requests[recieved_requests_index], client_id, crypto_box_PUBLICKEYBYTES); memcpy(received_requests[received_requests_index], client_id, crypto_box_PUBLICKEYBYTES);
++recieved_requests_index; ++received_requests_index;
} }
/* Check if a friend request was already recieved /* Check if a friend request was already received
return 0 if not, 1 if we did */ return 0 if not, 1 if we did */
static int request_recieved(uint8_t * client_id) static int request_received(uint8_t * client_id)
{ {
uint32_t i; uint32_t i;
for (i = 0; i < MAX_RECIEVED_STORED; ++i) { for (i = 0; i < MAX_RECEIVED_STORED; ++i) {
if (memcmp(recieved_requests[i], client_id, crypto_box_PUBLICKEYBYTES) == 0) if (memcmp(received_requests[i], client_id, crypto_box_PUBLICKEYBYTES) == 0)
return 1; return 1;
} }
@ -117,10 +117,10 @@ int friendreq_handlepacket(uint8_t * packet, uint32_t length, IP_Port source)
if (len == -1) if (len == -1)
return 1; return 1;
if (request_recieved(public_key)) if (request_received(public_key))
return 1; return 1;
addto_recievedlist(public_key); addto_receivedlist(public_key);
(*handle_friendrequest)(public_key, data, len); (*handle_friendrequest)(public_key, data, len);
} else { /* if request is not for us, try routing it. */ } else { /* if request is not for us, try routing it. */
if(route_packet(packet + 1, packet, length) == length) if(route_packet(packet + 1, packet, length) == length)

View File

@ -1,6 +1,6 @@
/* DHT cryptosendfiletest /* DHT cryptosendfiletest
* *
* This program sends or recieves a friend request. * This program sends or receives a friend request.
* *
* it also sends the encrypted data from a file to another client. * it also sends the encrypted data from a file to another client.
* Receives the file data that that client sends us. * Receives the file data that that client sends us.
@ -165,7 +165,7 @@ int main(int argc, char *argv[])
} }
} }
if(handle_friendrequest(acceptedfriend_public_key, request_data) > 1) { if(handle_friendrequest(acceptedfriend_public_key, request_data) > 1) {
printf("RECIEVED FRIEND REQUEST: %s\n", request_data); printf("RECEIVED FRIEND REQUEST: %s\n", request_data);
} }
/* if someone connected to us write what he sends to a file /* if someone connected to us write what he sends to a file

View File

@ -116,7 +116,7 @@ void printconnection(int connection_id)
} }
*/ */
/*( recieve packets and send them to the packethandler */ /*( receive packets and send them to the packethandler */
/*run doLossless_UDP(); */ /*run doLossless_UDP(); */
void Lossless_UDP() void Lossless_UDP()
{ {

View File

@ -1,12 +1,12 @@
/* Lossless_UDP testserver /* Lossless_UDP testserver
* A program that waits for a lossless UDP connection and then saves all the data recieved to a file. * A program that waits for a lossless UDP connection and then saves all the data received to a file.
* NOTE: this program simulates a 33% packet loss. * NOTE: this program simulates a 33% packet loss.
* *
* Best used in combination with Lossless_UDP_testclient * Best used in combination with Lossless_UDP_testclient
* *
* Compile with: gcc -O2 -Wall -lsodium -o testserver ../core/network.c ../core/Lossless_UDP.c Lossless_UDP_testserver.c * Compile with: gcc -O2 -Wall -lsodium -o testserver ../core/network.c ../core/Lossless_UDP.c Lossless_UDP_testserver.c
* *
* Command line argument is the name of the file to save what we recieve to. * Command line argument is the name of the file to save what we receive to.
* EX: ./testserver filename1.txt * EX: ./testserver filename1.txt
* *
* Copyright (C) 2013 Tox project All Rights Reserved. * Copyright (C) 2013 Tox project All Rights Reserved.
@ -113,7 +113,7 @@ void printconnection(int connection_id)
} }
*/ */
/* recieve packets and send them to the packethandler /* receive packets and send them to the packethandler
* run doLossless_UDP(); */ * run doLossless_UDP(); */
void Lossless_UDP() void Lossless_UDP()
{ {
@ -167,7 +167,7 @@ int main(int argc, char *argv[])
connection = incoming_connection(); connection = incoming_connection();
if(connection != -1) { if(connection != -1) {
if(is_connected(connection) == 2) { if(is_connected(connection) == 2) {
printf("Recieved the connection.\n"); printf("Received the connection.\n");
} }
break; break;
@ -184,7 +184,7 @@ int main(int argc, char *argv[])
kill_connection_in(connection, 3000000); kill_connection_in(connection, 3000000);
read = read_packet(connection, buffer); read = read_packet(connection, buffer);
if (read != 0) { if (read != 0) {
// printf("Recieved data.\n"); // printf("Received data.\n");
if (!fwrite(buffer, read, 1, file)) if (!fwrite(buffer, read, 1, file))
printf("file write error\n"); printf("file write error\n");
} }

View File

@ -4,7 +4,7 @@
* *
* It tries sending a message to the added friend. * It tries sending a message to the added friend.
* *
* If it recieves a message from a friend it replies back. * If it receives a message from a friend it replies back.
* *
* *
* 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 * 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 @@
void print_request(uint8_t * public_key, uint8_t * data, uint16_t length) void print_request(uint8_t * public_key, uint8_t * data, uint16_t length)
{ {
printf("Friend request recieved from: \n"); printf("Friend request received from: \n");
printf("ClientID: "); printf("ClientID: ");
uint32_t j; uint32_t j;
for(j = 0; j < 32; j++) for(j = 0; j < 32; j++)
@ -78,7 +78,7 @@ void print_request(uint8_t * public_key, uint8_t * data, uint16_t length)
void print_message(int friendnumber, uint8_t * string, uint16_t length) void print_message(int friendnumber, uint8_t * string, uint16_t length)
{ {
printf("Message with length %u recieved from %u: %s \n", length, friendnumber, string); printf("Message with length %u received from %u: %s \n", length, friendnumber, string);
m_sendmessage(friendnumber, (uint8_t*)"Test1", 6); m_sendmessage(friendnumber, (uint8_t*)"Test1", 6);
} }

View File

@ -18,17 +18,17 @@ a = 1;
#send ping request to our DHT on localhost. #send ping request to our DHT on localhost.
sock.sendto("0012345678".decode("hex") + client_id, ('127.0.0.1', 33445)) sock.sendto("0012345678".decode("hex") + client_id, ('127.0.0.1', 33445))
#print all packets recieved and respond to ping requests properly #print all packets received and respond to ping requests properly
while True: while True:
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
print "received message:", data.encode('hex'), " From:", addr print "received message:", data.encode('hex'), " From:", addr
#if we recieve a ping request. #if we receive a ping request.
print data[0].encode('hex') print data[0].encode('hex')
if data[0] == "00".decode('hex'): if data[0] == "00".decode('hex'):
print "Sending ping resp" print "Sending ping resp"
sock.sendto("01".decode('hex') + data[1:5] + client_id, addr) sock.sendto("01".decode('hex') + data[1:5] + client_id, addr)
#if we recieve a get_nodes request. #if we receive a get_nodes request.
if data[0] == "02".decode('hex'): if data[0] == "02".decode('hex'):
print "Sending getn resp" print "Sending getn resp"
#send send nodes packet with a couple 127.0.0.1 ips and ports. #send send nodes packet with a couple 127.0.0.1 ips and ports.