diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-10-16 15:07:39 +0000 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-10-16 15:07:39 +0000 |
commit | 72d08816abaa2935e8055d9cdfd73b59df5f9bd3 (patch) | |
tree | 6bc756bf1f9350e96e224dc49cd16477073e7586 | |
parent | bb2357de0cf04c6d8f41e7f7f72f1c033181d4e7 (diff) |
devtls: implement "hangup" ctl message
This makes devtls connection directories compatible to
hangup function (see dial(2)).
-rw-r--r-- | sys/src/9/port/devtls.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/src/9/port/devtls.c b/sys/src/9/port/devtls.c index 3409e37fb..4b691c50e 100644 --- a/sys/src/9/port/devtls.c +++ b/sys/src/9/port/devtls.c @@ -1751,10 +1751,10 @@ tlswrite(Chan *c, void *a, long n, vlong off) }else if(strcmp(cb->f[0], "alert") == 0){ if(cb->nf != 2) error("usage: alert n"); + m = strtol(cb->f[1], nil, 0); + Hangup: if(tr->c == nil) error("must set fd before sending alerts"); - m = strtol(cb->f[1], nil, 0); - qunlock(&tr->in.seclock); qunlock(&tr->out.seclock); poperror(); @@ -1767,6 +1767,9 @@ tlswrite(Chan *c, void *a, long n, vlong off) tlsclosed(tr, SLClose); return n; + } else if(strcmp(cb->f[0], "hangup") == 0){ + m = ECloseNotify; + goto Hangup; } else if(strcmp(cb->f[0], "debug") == 0){ if(cb->nf == 2){ if(strcmp(cb->f[1], "on") == 0) |