mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Fix a recurring typo in code and comments.
This commit is contained in:
parent
29264b58fc
commit
0b8fa72914
|
@ -132,7 +132,7 @@ int parent_wait_for_message(void)
|
|||
}
|
||||
|
||||
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);
|
||||
kill(child_pid, SIGKILL);
|
||||
return -1;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* Note:
|
||||
* 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. */
|
||||
|
||||
#include "../core/Messenger.h"
|
||||
|
|
|
@ -929,7 +929,7 @@ static int send_NATping(uint8_t * public_key, uint64_t ping_id, uint8_t type)
|
|||
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)
|
||||
{
|
||||
if (length < crypto_box_PUBLICKEYBYTES * 2 + crypto_box_NONCEBYTES + ENCRYPTION_PADDING
|
||||
|
|
|
@ -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.)*/
|
||||
|
||||
#define MAX_RECIEVED_STORED 32
|
||||
#define MAX_RECEIVED_STORED 32
|
||||
|
||||
static uint8_t recieved_requests[MAX_RECIEVED_STORED][crypto_box_PUBLICKEYBYTES];
|
||||
static uint16_t recieved_requests_index;
|
||||
static uint8_t received_requests[MAX_RECEIVED_STORED][crypto_box_PUBLICKEYBYTES];
|
||||
static uint16_t received_requests_index;
|
||||
|
||||
/*Add to list of recieved friend requests*/
|
||||
static void addto_recievedlist(uint8_t * client_id)
|
||||
/*Add to list of received friend requests*/
|
||||
static void addto_receivedlist(uint8_t * client_id)
|
||||
{
|
||||
if (recieved_requests_index >= MAX_RECIEVED_STORED)
|
||||
recieved_requests_index = 0;
|
||||
if (received_requests_index >= MAX_RECEIVED_STORED)
|
||||
received_requests_index = 0;
|
||||
|
||||
memcpy(recieved_requests[recieved_requests_index], client_id, crypto_box_PUBLICKEYBYTES);
|
||||
++recieved_requests_index;
|
||||
memcpy(received_requests[received_requests_index], client_id, crypto_box_PUBLICKEYBYTES);
|
||||
++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 */
|
||||
static int request_recieved(uint8_t * client_id)
|
||||
static int request_received(uint8_t * client_id)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < MAX_RECIEVED_STORED; ++i) {
|
||||
if (memcmp(recieved_requests[i], client_id, crypto_box_PUBLICKEYBYTES) == 0)
|
||||
for (i = 0; i < MAX_RECEIVED_STORED; ++i) {
|
||||
if (memcmp(received_requests[i], client_id, crypto_box_PUBLICKEYBYTES) == 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -117,10 +117,10 @@ int friendreq_handlepacket(uint8_t * packet, uint32_t length, IP_Port source)
|
|||
|
||||
if (len == -1)
|
||||
return 1;
|
||||
if (request_recieved(public_key))
|
||||
if (request_received(public_key))
|
||||
return 1;
|
||||
|
||||
addto_recievedlist(public_key);
|
||||
addto_receivedlist(public_key);
|
||||
(*handle_friendrequest)(public_key, data, len);
|
||||
} else { /* if request is not for us, try routing it. */
|
||||
if(route_packet(packet + 1, packet, length) == length)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* 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.
|
||||
* 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) {
|
||||
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
|
||||
|
|
|
@ -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(); */
|
||||
void Lossless_UDP()
|
||||
{
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/* 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.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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(); */
|
||||
void Lossless_UDP()
|
||||
{
|
||||
|
@ -167,7 +167,7 @@ int main(int argc, char *argv[])
|
|||
connection = incoming_connection();
|
||||
if(connection != -1) {
|
||||
if(is_connected(connection) == 2) {
|
||||
printf("Recieved the connection.\n");
|
||||
printf("Received the connection.\n");
|
||||
|
||||
}
|
||||
break;
|
||||
|
@ -184,7 +184,7 @@ int main(int argc, char *argv[])
|
|||
kill_connection_in(connection, 3000000);
|
||||
read = read_packet(connection, buffer);
|
||||
if (read != 0) {
|
||||
// printf("Recieved data.\n");
|
||||
// printf("Received data.\n");
|
||||
if (!fwrite(buffer, read, 1, file))
|
||||
printf("file write error\n");
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* 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
|
||||
|
@ -53,7 +53,7 @@
|
|||
|
||||
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: ");
|
||||
uint32_t 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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,17 +18,17 @@ a = 1;
|
|||
#send ping request to our DHT on localhost.
|
||||
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:
|
||||
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
|
||||
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')
|
||||
if data[0] == "00".decode('hex'):
|
||||
print "Sending ping resp"
|
||||
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'):
|
||||
print "Sending getn resp"
|
||||
#send send nodes packet with a couple 127.0.0.1 ips and ports.
|
||||
|
|
Loading…
Reference in New Issue
Block a user