new I/O multiplexer api; http echo server example draft to test the mux api; the library is now released as an amalgamation; recv/send now return the error MICROTCP_ERRCODE_WOULDBLOCK in a similar way to the BSD socket api; moved tests/loop2.c to examples/echo_tcp.c

This commit is contained in:
cozis
2023-05-19 20:24:13 +02:00
parent 2a8741afe4
commit 464a1ee724
27 changed files with 3370 additions and 690 deletions
+10 -5
View File
@@ -1,14 +1,17 @@
#include <string.h>
#include <stdbool.h>
#include <stdalign.h>
#include "endian.h"
#include "tcp.h"
#ifndef MICROTCP_AMALGAMATION
# include "endian.h"
# include "tcp.h"
#endif
#ifdef TCP_DEBUG
#include <stdio.h>
#define TCP_DEBUG_LOG(fmt, ...) fprintf(stderr, "TCP :: " fmt "\n", ## __VA_ARGS__)
# include <stdio.h>
# define TCP_DEBUG_LOG(fmt, ...) fprintf(stderr, "TCP :: " fmt "\n", ## __VA_ARGS__)
#else
#define TCP_DEBUG_LOG(...)
# define TCP_DEBUG_LOG(...)
#endif
#define SEGMENT_OFFSET(seg) (cpu_is_little_endian() ? (seg)->offset2 : (seg)->offset1)
@@ -532,6 +535,8 @@ tcp_listener_create(tcp_state_t *state, uint16_t port, void *callback_data,
void tcp_listener_destroy(tcp_listener_t *listener)
{
#warning "The previously accepted connections should't be closed with their listener.. I think"
// TODO: Close all connections
tcp_state_t *state = listener->state;