Separated establishing of dtls connection.
FossilOrigin-Name: c5f4d97816e785eef70020b65623cb70f550036bb41252ddedd5b50117834d6c
This commit is contained in:
parent
707b4b4196
commit
cf83867f09
@ -378,22 +378,22 @@ static void wtpman_run(void *arg)
|
||||
|
||||
|
||||
/* reject connections to our multi- or broadcast sockets */
|
||||
if (socklist[wtpman->socklistindex].type != SOCKLIST_UNICAST_SOCKET) {
|
||||
/* if (socklist[wtpman->socklistindex].type != SOCKLIST_UNICAST_SOCKET) {
|
||||
cw_dbg(DBG_DTLS, "Dropping connection from %s to non-unicast socket.",
|
||||
CLIENT_IP);
|
||||
wtpman_remove(wtpman);
|
||||
return;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
time_t timer = cw_timer_start(wtpman->conn->wait_dtls);
|
||||
|
||||
/* establish dtls session */
|
||||
if (!wtpman_establish_dtls(wtpman)) {
|
||||
/* if (!wtpman_establish_dtls(wtpman)) {
|
||||
wtpman_remove(wtpman);
|
||||
return;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/* dtls is established, goto join state */
|
||||
if (!wtpman_join(wtpman, timer)) {
|
||||
@ -480,6 +480,38 @@ static void wtpman_run(void *arg)
|
||||
}
|
||||
|
||||
|
||||
static void wtpman_run_dtls(void *arg)
|
||||
{
|
||||
|
||||
struct wtpman *wtpman = (struct wtpman *) arg;
|
||||
|
||||
|
||||
|
||||
/* reject connections to our multi- or broadcast sockets */
|
||||
if (socklist[wtpman->socklistindex].type != SOCKLIST_UNICAST_SOCKET) {
|
||||
cw_dbg(DBG_DTLS, "Dropping connection from %s to non-unicast socket.",
|
||||
CLIENT_IP);
|
||||
wtpman_remove(wtpman);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
time_t timer = cw_timer_start(wtpman->conn->wait_dtls);
|
||||
|
||||
/* establish dtls session */
|
||||
if (!wtpman_establish_dtls(wtpman)) {
|
||||
wtpman_remove(wtpman);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
wtpman_run(arg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wtpman_destroy(struct wtpman *wtpman)
|
||||
{
|
||||
if (wtpman->conn)
|
||||
@ -620,12 +652,12 @@ void wtpman_start(struct wtpman *wtpman, int dtlsmode)
|
||||
|
||||
if (dtlsmode) {
|
||||
cw_dbg(DBG_INFO, "Starting wtpman in DTLS mode");
|
||||
pthread_create(&wtpman->thread, NULL, (void *) &wtpman_run,
|
||||
pthread_create(&wtpman->thread, NULL, (void *) wtpman_run_dtls,
|
||||
(void *) wtpman);
|
||||
} else {
|
||||
cw_dbg(DBG_INFO, "Starting wtpman in non-dtls mode");
|
||||
|
||||
pthread_create(&wtpman->thread, NULL, (void *) &wtpman_run_discovery,
|
||||
pthread_create(&wtpman->thread, NULL, (void *) wtpman_run_discovery,
|
||||
(void *) wtpman);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user