diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-05-18 20:11:44 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-05-18 20:11:44 +0200 |
commit | 1152ec32b6086c153dc41da59c9c451aa4465995 (patch) | |
tree | de696dc61a4566a75b4df1df907cb1a2da25bd82 /main/sock.c | |
parent | cddfbb715d6f4f9d022d383ab8737b6af57a1d6f (diff) |
WIP send/receive w/ msgpack
Diffstat (limited to 'main/sock.c')
-rw-r--r-- | main/sock.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/main/sock.c b/main/sock.c index 7064de7..dac62af 100644 --- a/main/sock.c +++ b/main/sock.c @@ -5,9 +5,10 @@ #include <lwip/api.h> #include "init.h" - #include "config.h" +struct netconn* current_connection = NULL; + void recv_handler(struct netconn* conn, struct netbuf* buf) { void *data; uint16_t len; @@ -21,17 +22,16 @@ void recv_handler(struct netconn* conn, struct netbuf* buf) { } void accept_handler(struct netconn* conn) { - printf("new connection!\n"); + current_connection = conn; struct netbuf* buf; - while (netconn_recv(conn, &buf) == ERR_OK) recv_handler(conn, buf); netconn_close(conn); netconn_delete(conn); - printf("connection closed!\n"); + current_connection = NULL; } void serve_task() { |