From e183a9956be3c9ad3cb50c56a634041ece49e41a Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 28 Jan 2013 23:54:45 +0900 Subject: Add a little check to kill off an existing interrupt channel if it's died. --- vxi11_server.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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) { -- cgit