Check the return value of udp_new.
This commit is contained in:
parent
220e6f7b88
commit
6177187954
2 changed files with 8 additions and 0 deletions
|
@ -161,6 +161,10 @@ PROCESS_THREAD(udp_client_process, ev, data)
|
||||||
|
|
||||||
/* new connection with remote host */
|
/* new connection with remote host */
|
||||||
client_conn = udp_new(NULL, UIP_HTONS(UDP_SERVER_PORT), NULL);
|
client_conn = udp_new(NULL, UIP_HTONS(UDP_SERVER_PORT), NULL);
|
||||||
|
if(client_conn == NULL) {
|
||||||
|
PRINTF("No UDP connection available, exiting the process!\n");
|
||||||
|
PROCESS_EXIT();
|
||||||
|
}
|
||||||
udp_bind(client_conn, UIP_HTONS(UDP_CLIENT_PORT));
|
udp_bind(client_conn, UIP_HTONS(UDP_CLIENT_PORT));
|
||||||
|
|
||||||
PRINTF("Created a connection with the server ");
|
PRINTF("Created a connection with the server ");
|
||||||
|
|
|
@ -152,6 +152,10 @@ PROCESS_THREAD(udp_server_process, ev, data)
|
||||||
NETSTACK_MAC.off(1);
|
NETSTACK_MAC.off(1);
|
||||||
|
|
||||||
server_conn = udp_new(NULL, UIP_HTONS(UDP_CLIENT_PORT), NULL);
|
server_conn = udp_new(NULL, UIP_HTONS(UDP_CLIENT_PORT), NULL);
|
||||||
|
if(server_conn == NULL) {
|
||||||
|
PRINTF("No UDP connection available, exiting the process!\n");
|
||||||
|
PROCESS_EXIT();
|
||||||
|
}
|
||||||
udp_bind(server_conn, UIP_HTONS(UDP_SERVER_PORT));
|
udp_bind(server_conn, UIP_HTONS(UDP_SERVER_PORT));
|
||||||
|
|
||||||
PRINTF("Created a server connection with remote address ");
|
PRINTF("Created a server connection with remote address ");
|
||||||
|
|
Loading…
Reference in a new issue