re-indented
FossilOrigin-Name: 7973b2fa759f3820acf6a79727e3c8969b5f81b3813a8a076bdd61803d5ad6ee
This commit is contained in:
parent
2d5c4ab360
commit
e51d715b8b
@ -13,36 +13,37 @@
|
|||||||
|
|
||||||
int dtls_gnutls_connect(struct conn *conn)
|
int dtls_gnutls_connect(struct conn *conn)
|
||||||
{
|
{
|
||||||
struct dtls_gnutls_data * d;
|
struct dtls_gnutls_data *d;
|
||||||
d = dtls_gnutls_data_create(conn,GNUTLS_CLIENT | GNUTLS_DATAGRAM | GNUTLS_NONBLOCK);
|
d = dtls_gnutls_data_create(conn,
|
||||||
|
GNUTLS_CLIENT | GNUTLS_DATAGRAM | GNUTLS_NONBLOCK);
|
||||||
|
|
||||||
// gnutls_dh_set_prime_bits(d->session, 512);
|
// gnutls_dh_set_prime_bits(d->session, 512);
|
||||||
#if GNUTLS_VERSION_NUMBER >= 0x030100
|
#if GNUTLS_VERSION_NUMBER >= 0x030100
|
||||||
gnutls_handshake_set_timeout(d->session,GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT);
|
gnutls_handshake_set_timeout(d->session, GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT);
|
||||||
|
|
||||||
gnutls_dtls_set_data_mtu(d->session,1500);
|
gnutls_dtls_set_data_mtu(d->session, 1500);
|
||||||
#endif
|
#endif
|
||||||
gnutls_dtls_set_mtu(d->session,1500);
|
gnutls_dtls_set_mtu(d->session, 1500);
|
||||||
|
|
||||||
int rc;
|
int rc;
|
||||||
do {
|
do {
|
||||||
rc = gnutls_handshake(d->session);
|
rc = gnutls_handshake(d->session);
|
||||||
}while (rc==GNUTLS_E_AGAIN);
|
} while (rc == GNUTLS_E_AGAIN);
|
||||||
|
|
||||||
|
|
||||||
if (rc < 0){
|
if (rc < 0) {
|
||||||
cw_log(LOG_ERR,"Can't connect: %s",gnutls_strerror(rc));
|
cw_log(LOG_ERR, "DTLS (gnutls) Can't connect to %s: %s",
|
||||||
|
sock_addr2str(&conn->addr), gnutls_strerror(rc));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cw_dbg(DBG_DTLS,"Handshake with %s successful",sock_addr2str(&conn->addr));
|
cw_dbg(DBG_DTLS, "Handshake with %s successful", sock_addr2str(&conn->addr));
|
||||||
|
|
||||||
conn->dtls_data=d;
|
conn->dtls_data = d;
|
||||||
conn->read = dtls_gnutls_read;
|
conn->read = dtls_gnutls_read;
|
||||||
conn->write = dtls_gnutls_write;
|
conn->write = dtls_gnutls_write;
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user