sig init handles client connection fail
parent
e1c32dc77b
commit
94b36d99ce
|
@ -61,6 +61,8 @@ void sig_handler(const int sig)
|
||||||
{
|
{
|
||||||
printf("\nSIGINT handled.\n");
|
printf("\nSIGINT handled.\n");
|
||||||
cleanup = 1;
|
cleanup = 1;
|
||||||
|
CyaSSL_CTX_free(ctx);
|
||||||
|
CyaSSL_Cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AwaitDGram()
|
void AwaitDGram()
|
||||||
|
@ -71,11 +73,6 @@ void AwaitDGram()
|
||||||
|
|
||||||
while (cleanup != 1) {
|
while (cleanup != 1) {
|
||||||
|
|
||||||
if (cleanup == 1) {
|
|
||||||
CyaSSL_CTX_free(ctx);
|
|
||||||
CyaSSL_Cleanup();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a UDP/IP socket */
|
/* Create a UDP/IP socket */
|
||||||
if ( (listenfd = socket(AF_INET, SOCK_DGRAM, 0) ) < 0 ) {
|
if ( (listenfd = socket(AF_INET, SOCK_DGRAM, 0) ) < 0 ) {
|
||||||
printf("Cannot create socket.\n");
|
printf("Cannot create socket.\n");
|
||||||
|
@ -148,8 +145,7 @@ void AwaitDGram()
|
||||||
readWriteErr = CyaSSL_get_error(ssl, 0);
|
readWriteErr = CyaSSL_get_error(ssl, 0);
|
||||||
do {
|
do {
|
||||||
if (cleanup == 1) {
|
if (cleanup == 1) {
|
||||||
CyaSSL_CTX_free(ctx);
|
break;
|
||||||
CyaSSL_Cleanup();
|
|
||||||
}
|
}
|
||||||
if (recvlen < 0) {
|
if (recvlen < 0) {
|
||||||
readWriteErr = CyaSSL_get_error(ssl, 0);
|
readWriteErr = CyaSSL_get_error(ssl, 0);
|
||||||
|
@ -205,8 +201,7 @@ static void NonBlockingSSL_Accept(CYASSL* ssl)
|
||||||
(error == SSL_ERROR_WANT_READ ||
|
(error == SSL_ERROR_WANT_READ ||
|
||||||
error == SSL_ERROR_WANT_WRITE))) {
|
error == SSL_ERROR_WANT_WRITE))) {
|
||||||
if (cleanup == 1) {
|
if (cleanup == 1) {
|
||||||
CyaSSL_CTX_free(ctx);
|
break;
|
||||||
CyaSSL_Cleanup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int currTimeout = 1;
|
int currTimeout = 1;
|
||||||
|
|
Loading…
Reference in New Issue