Commit a69db6db authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

dist/sockets: dynamically allocate larger receive buffer

parent 0c0fbcbd
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
//#define SOCK_DEBUG //#define SOCK_DEBUG
#define MAX_PEERS 32 #define MAX_PEERS 32
#define RXBUF_SIZE (128 * 1024) #define RXBUF_SIZE (1024 * 1024)
#define TXBUF_SIZE (128 * 1024) #define TXBUF_SIZE (128 * 1024)
#define TXBUF_NUM 16 #define TXBUF_NUM 16
...@@ -93,7 +93,7 @@ static int epfd = -1; ...@@ -93,7 +93,7 @@ static int epfd = -1;
static int sockfd = -1; static int sockfd = -1;
static int msg_id = 0; static int msg_id = 0;
static uint8_t rx_buffer[RXBUF_SIZE]; static uint8_t *rx_buffer;
static size_t rx_buf_pos = 0; static size_t rx_buf_pos = 0;
static struct SockMsg *tx_msgs_free = NULL; static struct SockMsg *tx_msgs_free = NULL;
...@@ -184,6 +184,11 @@ static int SockAllocInit() { ...@@ -184,6 +184,11 @@ static int SockAllocInit() {
return 1; return 1;
} }
if ((rx_buffer = calloc(1, RXBUF_SIZE)) == NULL) {
perror("SockAllocInit rxbuf calloc failed");
return 1;
}
int i; int i;
for (i = 0; i < TXBUF_NUM; i++) { for (i = 0; i < TXBUF_NUM; i++) {
struct SockMsg *msg; struct SockMsg *msg;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment