diff options
Diffstat (limited to 'src/libpttls/pt_tls_dispatcher.c')
-rw-r--r-- | src/libpttls/pt_tls_dispatcher.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/libpttls/pt_tls_dispatcher.c b/src/libpttls/pt_tls_dispatcher.c index adcf5b4bf..fab44596c 100644 --- a/src/libpttls/pt_tls_dispatcher.c +++ b/src/libpttls/pt_tls_dispatcher.c @@ -45,6 +45,11 @@ struct private_pt_tls_dispatcher_t { * Server identity */ identification_t *server; + + /** + * TNCCS protocol handler constructor + */ + tnccs_t*(*create)(); }; /** @@ -106,11 +111,12 @@ static void cleanup(pt_tls_server_t *connection) } METHOD(pt_tls_dispatcher_t, dispatch, void, - private_pt_tls_dispatcher_t *this) + private_pt_tls_dispatcher_t *this, tnccs_t*(*create)()) { while (TRUE) { pt_tls_server_t *connection; + tnccs_t *tnccs; bool old; int fd; @@ -123,7 +129,13 @@ METHOD(pt_tls_dispatcher_t, dispatch, void, continue; } - connection = pt_tls_server_create(this->server, fd); + tnccs = create(); + if (!tnccs) + { + close(fd); + continue; + } + connection = pt_tls_server_create(this->server, fd, tnccs); if (!connection) { close(fd); |