Skip to content

Commit

Permalink
more cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
philljj committed Sep 17, 2024
1 parent 8c57fd3 commit 9510506
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
11 changes: 6 additions & 5 deletions dtls/client-dtls-resume.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@
#define MAXLINE 4096
#define SERV_PORT 11111

static int new_udp_client_socket(WOLFSSL * ssl, const char * host);
static int talk_to_server(WOLFSSL * ssl, const char * msg);
static int new_udp_client_socket(WOLFSSL * ssl, const char * host);
static int talk_to_server(WOLFSSL * ssl, const char * msg);

int main (int argc, char** argv)
int
main(int argc,
char * argv[])
{
/* standard variables used in a dtls client*/
int sockfd = 0;
Expand All @@ -52,7 +54,6 @@ int main (int argc, char** argv)
WOLFSSL * ssl_res = NULL; /* The ssl for resuming connection. */
WOLFSSL_CTX * ctx = NULL;
WOLFSSL_SESSION * session = NULL;
//const char * msg = "client testing session resume";
char cert_array[] = "../certs/ca-cert.pem";
char buffer[80];
char * certs = cert_array;
Expand Down Expand Up @@ -258,7 +259,7 @@ talk_to_server(WOLFSSL * ssl,
}

recv_msg[recv_len] = '\0';
fputs(recv_msg, stdout);
printf("info: server response: %s", recv_msg);

return 0;
}
5 changes: 2 additions & 3 deletions dtls/server-dtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ int main(int argc, char** argv)
int readErr = wolfSSL_get_error(ssl, 0);
if(readErr != SSL_ERROR_WANT_READ) {
printf("SSL_read failed.\n");
goto error;
break;
}
}
if (wolfSSL_write(ssl, ack, sizeof(ack)) < 0) {
printf("wolfSSL_write fail.\n");
goto error;
break;
}
else {
printf("Sending reply.\n");
Expand All @@ -217,7 +217,6 @@ int main(int argc, char** argv)
printf("Client left cont to idle state\n");
}

error:
if (cleanup == 1) {
wolfSSL_set_fd(ssl, 0);
wolfSSL_shutdown(ssl);
Expand Down

0 comments on commit 9510506

Please sign in to comment.