diff options
author | daniel <danieruru@gmail.com> | 2013-01-28 23:54:45 +0900 |
---|---|---|
committer | daniel <danieruru@gmail.com> | 2013-01-28 23:54:45 +0900 |
commit | e183a9956be3c9ad3cb50c56a634041ece49e41a (patch) | |
tree | 2a8a2c6bc011e629cfd7b3f6caec6b5c2d45be15 /vxi11_server.c | |
parent | 237c74240feecedd4b4206eb4a447736cbcb5a9c (diff) |
Add a little check to kill off an existing interrupt channel if it's died.
Diffstat (limited to 'vxi11_server.c')
-rw-r--r-- | vxi11_server.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/vxi11_server.c b/vxi11_server.c index 79ff9f7..11fdf87 100644 --- a/vxi11_server.c +++ b/vxi11_server.c @@ -523,6 +523,18 @@ create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) { printf("Client %s is asking for an interrupt connection on port %u\n", clientaddressstring, (unsigned int) argp->hostPort); #endif + + // if a client had an interrupt channel and died without closing it + // we need to clean it up to avoid a deadlock + static struct rpc_err err; + if (intclient != NULL) { + clnt_geterr(intclient, &err); + if (err.re_errno != 0) { + clnt_destroy(intclient); + intclient = NULL; + } + } + if (argp->progFamily != DEVICE_TCP || argp->progNum != DEVICE_INTR || argp->progVers != DEVICE_INTR_VERSION) result.error = ERR_OPERATIONNOTSUPPORTED; else if (intclient != NULL) { |