summaryrefslogtreecommitdiff
path: root/src/net.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/net.c')
-rw-r--r--src/net.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/net.c b/src/net.c
index 18970c1..b5edc07 100644
--- a/src/net.c
+++ b/src/net.c
@@ -16,11 +16,11 @@
#include "net.h"
-void invalid_pkt(str from, str pkt)
+void invalid_pkt(peer *from, str pkt)
{
// TODO: maybe inform peer about failure? not sure
// FIXME: hexdumping a gazillon bytes to stderr might be an issue
- fprintf(stderr, "invalid pkt from %*s: ", PSTR(from));
+ fprintf(stderr, "invalid pkt from %*s: ", PSTR(*from->name));
for (size_t i = 0; i < pkt.len; i++)
fprintf(stderr, "%02x%c", (uint8_t) pkt.data[i], i+1 == pkt.len ? '\n' : ' ');
}
@@ -76,10 +76,11 @@ int socket_accept(int accept_fd)
return socket;
}
-void peer_init(peer *p, int socket)
+void peer_init(peer *p, int socket, str *name)
{
p->socket = socket;
p->disco = false;
+ p->name = name;
p->in.header = true;
p->in.len = 0;