From 7da87a7db53900a23844a4ea6388a3327f015656 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Fri, 28 Feb 2020 08:23:43 +0100 Subject: [PATCH] examples/dtls-wolfssl: cleanup output messages --- examples/dtls-wolfssl/dtls-client.c | 14 +++++++------- examples/dtls-wolfssl/dtls-server.c | 16 ++++++++-------- examples/dtls-wolfssl/main.c | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/examples/dtls-wolfssl/dtls-client.c b/examples/dtls-wolfssl/dtls-client.c index fc6d784dfd..44a3c34a33 100644 --- a/examples/dtls-wolfssl/dtls-client.c +++ b/examples/dtls-wolfssl/dtls-client.c @@ -111,20 +111,20 @@ int dtls_client(int argc, char **argv) else { gnrc_netif_t *netif = gnrc_netif_get_by_pid(atoi(iface)); if (netif == NULL) { - LOG(LOG_ERROR, "ERROR: interface not valid"); + LOG(LOG_ERROR, "ERROR: interface not valid\n"); usage(argv[0]); return -1; } remote.netif = (uint16_t)netif->pid; } if (ipv6_addr_from_str((ipv6_addr_t *)remote.addr.ipv6, addr_str) == NULL) { - LOG(LOG_ERROR, "ERROR: unable to parse destination address"); + LOG(LOG_ERROR, "ERROR: unable to parse destination address\n"); usage(argv[0]); return -1; } remote.port = SERVER_PORT; if (sock_dtls_create(sk, &local, &remote, 0, wolfDTLSv1_2_client_method()) != 0) { - LOG(LOG_ERROR, "ERROR: Unable to create DTLS sock"); + LOG(LOG_ERROR, "ERROR: Unable to create DTLS sock\n"); return -1; } @@ -147,7 +147,7 @@ int dtls_client(int argc, char **argv) if (sock_dtls_session_create(sk) < 0) return -1; wolfSSL_dtls_set_timeout_init(sk->ssl, 5); - LOG(LOG_INFO, "connecting to server..."); + LOG(LOG_INFO, "connecting to server...\n"); /* attempt to connect until the connection is successful */ do { ret = wolfSSL_connect(sk->ssl); @@ -179,13 +179,13 @@ int dtls_client(int argc, char **argv) /* wait for a reply, indefinitely */ do { ret = wolfSSL_read(sk->ssl, buf, APP_DTLS_BUF_SIZE - 1); - LOG(LOG_INFO, "wolfSSL_read returned %d\r\n", ret); + LOG(LOG_INFO, "wolfSSL_read returned %d\n", ret); } while (ret <= 0); buf[ret] = (char)0; - LOG(LOG_INFO, "Received: '%s'\r\n", buf); + LOG(LOG_INFO, "Received: '%s'\n", buf); /* Clean up and exit. */ - LOG(LOG_INFO, "Closing connection.\r\n"); + LOG(LOG_INFO, "Closing connection.\n"); sock_dtls_session_destroy(sk); sock_dtls_close(sk); return 0; diff --git a/examples/dtls-wolfssl/dtls-server.c b/examples/dtls-wolfssl/dtls-server.c index 81da6e4db6..3fb9303b34 100644 --- a/examples/dtls-wolfssl/dtls-server.c +++ b/examples/dtls-wolfssl/dtls-server.c @@ -94,7 +94,7 @@ int dtls_server(int argc, char **argv) (void)argv; if (sock_dtls_create(sk, &local, NULL, 0, wolfDTLSv1_2_server_method()) != 0) { - LOG(LOG_ERROR, "ERROR: Unable to create DTLS sock\r\n"); + LOG(LOG_ERROR, "ERROR: Unable to create DTLS sock\n"); return -1; } @@ -103,7 +103,7 @@ int dtls_server(int argc, char **argv) if (wolfSSL_CTX_use_certificate_buffer(sk->ctx, server_cert, server_cert_len, SSL_FILETYPE_ASN1 ) != SSL_SUCCESS) { - LOG(LOG_ERROR, "Failed to load certificate from memory.\r\n"); + LOG(LOG_ERROR, "Failed to load certificate from memory.\n"); return -1; } @@ -111,7 +111,7 @@ int dtls_server(int argc, char **argv) if (wolfSSL_CTX_use_PrivateKey_buffer(sk->ctx, server_key, server_key_len, SSL_FILETYPE_ASN1 ) != SSL_SUCCESS) { - LOG(LOG_ERROR, "Failed to load private key from memory.\r\n"); + LOG(LOG_ERROR, "Failed to load private key from memory.\n"); return -1; } #else @@ -123,7 +123,7 @@ int dtls_server(int argc, char **argv) ret = sock_dtls_session_create(sk); if (ret < 0) { - LOG(LOG_ERROR, "Failed to create DTLS session (err: %s)\r\n", strerror(-ret)); + LOG(LOG_ERROR, "Failed to create DTLS session (err: %s)\n", strerror(-ret)); return -1; } @@ -141,19 +141,19 @@ int dtls_server(int argc, char **argv) } /* Wait until data is received */ - LOG(LOG_INFO, "Connection accepted\r\n"); + LOG(LOG_INFO, "Connection accepted\n"); ret = wolfSSL_read(sk->ssl, buf, APP_DTLS_BUF_SIZE); if (ret > 0) { buf[ret] = (char)0; - LOG(LOG_INFO, "Received '%s'\r\n", buf); + LOG(LOG_INFO, "Received '%s'\n", buf); } /* Send reply */ - LOG(LOG_INFO, "Sending 'DTLS OK'...\r\n"); + LOG(LOG_INFO, "Sending 'DTLS OK'...\n"); wolfSSL_write(sk->ssl, Test_dtls_string, sizeof(Test_dtls_string)); /* Cleanup/shutdown */ - LOG(LOG_INFO, "Closing connection.\r\n"); + LOG(LOG_INFO, "Closing connection.\n"); sock_dtls_session_destroy(sk); sock_dtls_close(sk); break; diff --git a/examples/dtls-wolfssl/main.c b/examples/dtls-wolfssl/main.c index 9d02945363..9a8059c3bb 100644 --- a/examples/dtls-wolfssl/main.c +++ b/examples/dtls-wolfssl/main.c @@ -62,12 +62,12 @@ int main(void) /* we need a message queue for the thread running the shell in order to * receive potentially fast incoming networking packets */ msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE); - LOG(LOG_INFO, "RIOT wolfSSL DTLS testing implementation"); + LOG(LOG_INFO, "RIOT wolfSSL DTLS testing implementation\n"); wolfSSL_Init(); wolfSSL_Debugging_ON(); /* start shell */ - LOG(LOG_INFO, "All up, running the shell now"); + LOG(LOG_INFO, "All up, running the shell now\n"); char line_buf[SHELL_DEFAULT_BUFSIZE]; shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);