Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
a69db6db
Commit
a69db6db
authored
Aug 24, 2021
by
Antoine Kaufmann
Browse files
dist/sockets: dynamically allocate larger receive buffer
parent
0c0fbcbd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
dist/sockets/net_sockets.c
dist/sockets/net_sockets.c
+7
-2
No files found.
dist/sockets/net_sockets.c
View file @
a69db6db
...
@@ -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 (1
28
* 1024)
#define RXBUF_SIZE (1
024
* 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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment