summaryrefslogtreecommitdiff
path: root/test/proto.c
diff options
context:
space:
mode:
authorJesper Jensen <DelusionalLogic@users.noreply.github.com>2021-10-27 20:29:41 +0200
committerGitHub <noreply@github.com>2021-10-27 20:29:41 +0200
commit4527a87385c56cb2a5cf0269d4638b604a1f039b (patch)
tree031e8a09ec26229b31f58e2189d0023898881d20 /test/proto.c
parentef39868b6bffa3030c7cbc083df1301849fba0f7 (diff)
parent42a627aab5e47c3f3e05460322b9c1c3f2c69214 (diff)
Merge pull request #1 from DelusionalLogic/mainflush
Mainflush
Diffstat (limited to 'test/proto.c')
-rw-r--r--test/proto.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/proto.c b/test/proto.c
index 277f68c..60fa1cd 100644
--- a/test/proto.c
+++ b/test/proto.c
@@ -10,6 +10,7 @@ void test_begin_pings_bootstrap_node() {
struct dht dht;
dht.self = (struct nodeid){.inner={0x42424242, 0x42424242, 0x42424242, 0x42424242, 0x42424242}};
+ routing_init(&dht.self);
struct message* message_cursor = outbuff;
proto_begin(&dht, time(NULL), &message_cursor, outbuff+10);
@@ -28,6 +29,8 @@ void test_response_from_initial_probe() {
struct dht dht;
dht.self = (struct nodeid){.inner={0x42424242, 0x42424242, 0x42424242, 0x42424242, 0x42424242}};
+ routing_init(&dht.self);
+
{
struct message* message_cursor = outbuff;
proto_begin(&dht, time(NULL), &message_cursor, outbuff+2);
@@ -58,6 +61,7 @@ void test_reponse_from_wrong_ip() {
struct dht dht;
dht.self = (struct nodeid){.inner={0x42424242, 0x42424242, 0x42424242, 0x42424242, 0x42424242}};
+ routing_init(&dht.self);
{
struct message* message_cursor = outbuff;
proto_begin(&dht, time(NULL), &message_cursor, outbuff+2);
@@ -90,6 +94,7 @@ void test_ping() {
struct dht dht;
dht.self = (struct nodeid){.inner={0x42424242, 0x42424242, 0x42424242, 0x42424242, 0x42424242}};
+ routing_init(&dht.self);
{
struct message* message_cursor = outbuff;
proto_begin(&dht, time(NULL), &message_cursor, outbuff+2);
@@ -116,6 +121,7 @@ void test_unknown_method() {
struct dht dht;
dht.self = (struct nodeid){.inner={0x42424242, 0x42424242, 0x42424242, 0x42424242, 0x42424242}};
+ routing_init(&dht.self);
{
struct message* message_cursor = outbuff;
proto_begin(&dht, time(NULL), &message_cursor, outbuff+2);
@@ -138,7 +144,6 @@ void test_unknown_method() {
}
void test_note_times_out() {
- routing_flush();
struct message outbuff[2] = {0};
struct sockaddr_storage remote;
@@ -146,6 +151,7 @@ void test_note_times_out() {
struct dht dht;
dht.self = (struct nodeid){.inner={0x42424242, 0x42424242, 0x42424242, 0x42424242, 0x42424242}};
+ routing_init(&dht.self);
{
struct message* message_cursor = outbuff;
proto_begin(&dht, 0, &message_cursor, outbuff+2);
@@ -176,6 +182,7 @@ void test_response_after_retry() {
struct dht dht;
dht.self = (struct nodeid){.inner={0x42424242, 0x42424242, 0x42424242, 0x42424242, 0x42424242}};
+ routing_init(&dht.self);
{
struct message* message_cursor = outbuff;
@@ -201,6 +208,7 @@ void test_remove_from_routing_after_3_retries() {
struct dht dht;
dht.self = (struct nodeid){.inner={0x42424242, 0x42424242, 0x42424242, 0x42424242, 0x42424242}};
+ routing_init(&dht.self);
struct nodeid other = (struct nodeid){.inner={0x61616161, 0x61616161, 0x61616161, 0x61616161, 0x61616161}};
{
@@ -264,6 +272,7 @@ void test_ping_node_when_uncertain() {
struct dht dht;
dht.self = (struct nodeid){.inner={0x42424242, 0x42424242, 0x42424242, 0x42424242, 0x42424242}};
+ routing_init(&dht.self);
struct nodeid other = (struct nodeid){.inner={0x61616161, 0x61616161, 0x61616161, 0x61616161, 0x61616161}};
{
@@ -320,6 +329,7 @@ void test_query_find_node() {
struct dht dht;
dht.self = (struct nodeid){.inner={0x42424242, 0x42424242, 0x42424242, 0x42424242, 0x42424242}};
+ routing_init(&dht.self);
struct nodeid other = (struct nodeid){.inner={0x61616161, 0x61616161, 0x61616161, 0x61616161, 0x61616161}};
{