diff --git a/common/trans.c b/common/trans.c index 55d2a638..7a98986c 100644 --- a/common/trans.c +++ b/common/trans.c @@ -120,6 +120,12 @@ trans_delete(struct trans *self) return; } + /* Call the user-specified destructor if one exists */ + if (self->extra_destructor != NULL) + { + self->extra_destructor(self); + } + free_stream(self->in_s); free_stream(self->out_s); diff --git a/common/trans.h b/common/trans.h index 876e8b9b..9810cefd 100644 --- a/common/trans.h +++ b/common/trans.h @@ -108,6 +108,9 @@ struct trans char port[256]; int no_stream_init_on_data_in; int extra_flags; /* user defined */ + void *extra_data; /* user defined */ + void (*extra_destructor)(struct trans *); /* user defined */ + struct ssl_tls *tls; const char *ssl_protocol; /* e.g. TLSv1, TLSv1.1, TLSv1.2, unknown */ const char *cipher_name; /* e.g. AES256-GCM-SHA384 */