Improved connect procedure + debugging.
FossilOrigin-Name: f49750b6c69bcd8034fe4da04bc2fb65e1f2ac9ecda34b45e69a7bb3d33103fc
This commit is contained in:
parent
a4ff5c7504
commit
86d1d08fa9
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "dtls_openssl.h"
|
#include "dtls_openssl.h"
|
||||||
#include "cw_log.h"
|
#include "cw_log.h"
|
||||||
|
#include "cw_util.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
static BIO_METHOD bio_methods = {
|
static BIO_METHOD bio_methods = {
|
||||||
@ -53,55 +54,25 @@ int dtls_openssl_connect(struct conn *conn)
|
|||||||
// if (conn->dtls_psk)
|
// if (conn->dtls_psk)
|
||||||
// SSL_set_psk_client_callback(d->ssl, psk_client_cb);
|
// SSL_set_psk_client_callback(d->ssl, psk_client_cb);
|
||||||
|
|
||||||
|
|
||||||
// dtls_openssl_set_certs(conn,d);
|
|
||||||
|
|
||||||
if (conn->dtls_cert_file && conn->dtls_key_file) {
|
|
||||||
}
|
|
||||||
// char errstr[256];
|
|
||||||
int rc;
|
int rc;
|
||||||
// do{
|
|
||||||
|
|
||||||
printf("Calling SSL connect\n");
|
errno =0;
|
||||||
rc = SSL_connect(d->ssl);
|
time_t timer = cw_timer_start(10);
|
||||||
printf("Back from SSL connect\n");
|
do {
|
||||||
exit(0);
|
rc = SSL_connect(d->ssl);
|
||||||
/*
|
}while(rc!=1 && errno==EAGAIN && !cw_timer_timeout(timer));
|
||||||
|
|
||||||
if (rc <= 0){
|
|
||||||
int e;
|
|
||||||
e = SSL_get_error(d->ssl,rc);
|
|
||||||
printf("Get Err %i\n",e);
|
|
||||||
|
|
||||||
|
|
||||||
printf("SSL Connect rc = %i\n",rc);
|
|
||||||
e = ERR_get_error();
|
|
||||||
ERR_error_string(e,errstr);
|
|
||||||
cw_log(LOG_ERR,"SSL_connect %s",errstr);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (rc == 1) {
|
if (rc == 1) {
|
||||||
|
cw_dbg(DBG_DTLS,"SSL connect successfull!");
|
||||||
conn->read = dtls_openssl_read;
|
conn->read = dtls_openssl_read;
|
||||||
conn->write = dtls_openssl_write;
|
conn->write = dtls_openssl_write;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// rc = dtls_openssl_log_error(d->ssl,rc,"DTLS connect");
|
|
||||||
rc = dtls_openssl_log_error(0, rc, "DTLS connect");
|
rc = dtls_openssl_log_error(0, rc, "DTLS connect");
|
||||||
|
|
||||||
// } while (rc == 0 );
|
|
||||||
|
|
||||||
// printf("DTLS connect RC: %i\n",rc);
|
|
||||||
|
|
||||||
// int e = ERR_get_error();
|
|
||||||
// ERR_error_string(e,errstr);
|
|
||||||
// cw_log(LOG_ERR,"SSL_accept %s",errstr);
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user