more cleanup.
parent
8c57fd34ad
commit
95105068c6
|
@ -42,7 +42,9 @@
|
||||||
static int new_udp_client_socket(WOLFSSL * ssl, const char * host);
|
static int new_udp_client_socket(WOLFSSL * ssl, const char * host);
|
||||||
static int talk_to_server(WOLFSSL * ssl, const char * msg);
|
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*/
|
/* standard variables used in a dtls client*/
|
||||||
int sockfd = 0;
|
int sockfd = 0;
|
||||||
|
@ -52,7 +54,6 @@ int main (int argc, char** argv)
|
||||||
WOLFSSL * ssl_res = NULL; /* The ssl for resuming connection. */
|
WOLFSSL * ssl_res = NULL; /* The ssl for resuming connection. */
|
||||||
WOLFSSL_CTX * ctx = NULL;
|
WOLFSSL_CTX * ctx = NULL;
|
||||||
WOLFSSL_SESSION * session = NULL;
|
WOLFSSL_SESSION * session = NULL;
|
||||||
//const char * msg = "client testing session resume";
|
|
||||||
char cert_array[] = "../certs/ca-cert.pem";
|
char cert_array[] = "../certs/ca-cert.pem";
|
||||||
char buffer[80];
|
char buffer[80];
|
||||||
char * certs = cert_array;
|
char * certs = cert_array;
|
||||||
|
@ -258,7 +259,7 @@ talk_to_server(WOLFSSL * ssl,
|
||||||
}
|
}
|
||||||
|
|
||||||
recv_msg[recv_len] = '\0';
|
recv_msg[recv_len] = '\0';
|
||||||
fputs(recv_msg, stdout);
|
printf("info: server response: %s", recv_msg);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,12 +194,12 @@ int main(int argc, char** argv)
|
||||||
int readErr = wolfSSL_get_error(ssl, 0);
|
int readErr = wolfSSL_get_error(ssl, 0);
|
||||||
if(readErr != SSL_ERROR_WANT_READ) {
|
if(readErr != SSL_ERROR_WANT_READ) {
|
||||||
printf("SSL_read failed.\n");
|
printf("SSL_read failed.\n");
|
||||||
goto error;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wolfSSL_write(ssl, ack, sizeof(ack)) < 0) {
|
if (wolfSSL_write(ssl, ack, sizeof(ack)) < 0) {
|
||||||
printf("wolfSSL_write fail.\n");
|
printf("wolfSSL_write fail.\n");
|
||||||
goto error;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("Sending reply.\n");
|
printf("Sending reply.\n");
|
||||||
|
@ -217,7 +217,6 @@ int main(int argc, char** argv)
|
||||||
printf("Client left cont to idle state\n");
|
printf("Client left cont to idle state\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
error:
|
|
||||||
if (cleanup == 1) {
|
if (cleanup == 1) {
|
||||||
wolfSSL_set_fd(ssl, 0);
|
wolfSSL_set_fd(ssl, 0);
|
||||||
wolfSSL_shutdown(ssl);
|
wolfSSL_shutdown(ssl);
|
||||||
|
|
Loading…
Reference in New Issue