mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
lwip: amend for async callback argument
This commit is contained in:
parent
f97e97555c
commit
fe53525416
@ -46,7 +46,7 @@ static msg_t server_msg_queue[SERVER_MSG_QUEUE_SIZE];
|
|||||||
|
|
||||||
static void _ip_recv(sock_ip_t *sock, sock_async_flags_t flags, void *arg)
|
static void _ip_recv(sock_ip_t *sock, sock_async_flags_t flags, void *arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
assert(strcmp(arg, "test") == 0);
|
||||||
if (flags & SOCK_ASYNC_MSG_RECV) {
|
if (flags & SOCK_ASYNC_MSG_RECV) {
|
||||||
sock_ip_ep_t src;
|
sock_ip_ep_t src;
|
||||||
int res;
|
int res;
|
||||||
@ -90,7 +90,7 @@ static void *_server_thread(void *args)
|
|||||||
server_running = true;
|
server_running = true;
|
||||||
printf("Success: started IP server on protocol %u\n", protocol);
|
printf("Success: started IP server on protocol %u\n", protocol);
|
||||||
event_queue_init(&queue);
|
event_queue_init(&queue);
|
||||||
sock_ip_event_init(&server_sock, &queue, _ip_recv, NULL);
|
sock_ip_event_init(&server_sock, &queue, _ip_recv, "test");
|
||||||
event_loop(&queue);
|
event_loop(&queue);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ static void _tcp_recv(sock_tcp_t *sock, sock_async_flags_t flags, void *arg)
|
|||||||
{
|
{
|
||||||
sock_tcp_ep_t client;
|
sock_tcp_ep_t client;
|
||||||
|
|
||||||
(void)arg;
|
assert(strcmp(arg, "test") == 0);
|
||||||
if (sock_tcp_get_remote(sock, &client) < 0) {
|
if (sock_tcp_get_remote(sock, &client) < 0) {
|
||||||
/* socket was disconnected between event firing and this handler */
|
/* socket was disconnected between event firing and this handler */
|
||||||
return;
|
return;
|
||||||
@ -89,7 +89,7 @@ static void _tcp_recv(sock_tcp_t *sock, sock_async_flags_t flags, void *arg)
|
|||||||
static void _tcp_accept(sock_tcp_queue_t *queue, sock_async_flags_t flags,
|
static void _tcp_accept(sock_tcp_queue_t *queue, sock_async_flags_t flags,
|
||||||
void *arg)
|
void *arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
assert(strcmp(arg, "test") == 0);
|
||||||
if (flags & SOCK_ASYNC_CONN_RECV) {
|
if (flags & SOCK_ASYNC_CONN_RECV) {
|
||||||
sock_tcp_t *sock = NULL;
|
sock_tcp_t *sock = NULL;
|
||||||
int res;
|
int res;
|
||||||
@ -100,7 +100,7 @@ static void _tcp_accept(sock_tcp_queue_t *queue, sock_async_flags_t flags,
|
|||||||
else {
|
else {
|
||||||
sock_tcp_ep_t client;
|
sock_tcp_ep_t client;
|
||||||
|
|
||||||
sock_tcp_event_init(sock, &_ev_queue, _tcp_recv, NULL);
|
sock_tcp_event_init(sock, &_ev_queue, _tcp_recv, "test");
|
||||||
sock_tcp_get_remote(sock, &client);
|
sock_tcp_get_remote(sock, &client);
|
||||||
#ifdef MODULE_LWIP_IPV6
|
#ifdef MODULE_LWIP_IPV6
|
||||||
ipv6_addr_to_str(_addr_str, (ipv6_addr_t *)&client.addr.ipv6,
|
ipv6_addr_to_str(_addr_str, (ipv6_addr_t *)&client.addr.ipv6,
|
||||||
@ -132,7 +132,7 @@ static void *_server_thread(void *args)
|
|||||||
printf("Success: started TCP server on port %" PRIu16 "\n",
|
printf("Success: started TCP server on port %" PRIu16 "\n",
|
||||||
server_addr.port);
|
server_addr.port);
|
||||||
event_queue_init(&_ev_queue);
|
event_queue_init(&_ev_queue);
|
||||||
sock_tcp_queue_event_init(&server_queue, &_ev_queue, _tcp_accept, NULL);
|
sock_tcp_queue_event_init(&server_queue, &_ev_queue, _tcp_accept, "test");
|
||||||
event_loop(&_ev_queue);
|
event_loop(&_ev_queue);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ static msg_t server_msg_queue[SERVER_MSG_QUEUE_SIZE];
|
|||||||
|
|
||||||
static void _udp_recv(sock_udp_t *sock, sock_async_flags_t flags, void *arg)
|
static void _udp_recv(sock_udp_t *sock, sock_async_flags_t flags, void *arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
assert(strcmp(arg, "test") == 0);
|
||||||
if (flags & SOCK_ASYNC_MSG_RECV) {
|
if (flags & SOCK_ASYNC_MSG_RECV) {
|
||||||
sock_udp_ep_t src;
|
sock_udp_ep_t src;
|
||||||
int res;
|
int res;
|
||||||
@ -93,7 +93,7 @@ static void *_server_thread(void *args)
|
|||||||
printf("Success: started UDP server on port %" PRIu16 "\n",
|
printf("Success: started UDP server on port %" PRIu16 "\n",
|
||||||
server_addr.port);
|
server_addr.port);
|
||||||
event_queue_init(&queue);
|
event_queue_init(&queue);
|
||||||
sock_udp_event_init(&server_sock, &queue, _udp_recv, NULL);
|
sock_udp_event_init(&server_sock, &queue, _udp_recv, "test");
|
||||||
event_loop(&queue);
|
event_loop(&queue);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user