diff options
Diffstat (limited to 'vxi11_server.c')
-rw-r--r-- | vxi11_server.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/vxi11_server.c b/vxi11_server.c index 11fdf87..3f47c07 100644 --- a/vxi11_server.c +++ b/vxi11_server.c @@ -516,12 +516,15 @@ destroy_link_1_svc(Device_Link *argp, struct svc_req *rqstp) { Device_Error * create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) { static Device_Error result; + + in_port_t port = htons(argp->hostPort); + uint32_t addr = htonl(argp->hostAddr); + #ifdef DEBUG printf("create_intr_chan_1_svc()\n"); char clientaddressstring[INET_ADDRSTRLEN]; - inet_ntop(AF_INET, &argp->hostAddr, clientaddressstring, sizeof(clientaddressstring)); - printf("Client %s is asking for an interrupt connection on port %u\n", clientaddressstring, - (unsigned int) argp->hostPort); + inet_ntop(AF_INET, &addr, clientaddressstring, sizeof(clientaddressstring)); + printf("Client %s is asking for an interrupt connection on port %u\n", clientaddressstring, (unsigned int) port); #endif // if a client had an interrupt channel and died without closing it @@ -530,6 +533,9 @@ create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) { if (intclient != NULL) { clnt_geterr(intclient, &err); if (err.re_errno != 0) { +#ifdef DEBUG + printf("killing stale client\n"); +#endif clnt_destroy(intclient); intclient = NULL; } @@ -543,8 +549,8 @@ create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) { else { struct sockaddr_in clientaddr; clientaddr.sin_family = AF_INET; - clientaddr.sin_port = htons(argp->hostPort); - clientaddr.sin_addr.s_addr = argp->hostAddr; + clientaddr.sin_port = port; + clientaddr.sin_addr.s_addr = addr; int sock = RPC_ANYSOCK; CLIENT* clnt = clnttcp_create(&clientaddr, DEVICE_INTR, DEVICE_INTR_VERSION, &sock, 0, 0); if (clnt == NULL) { @@ -556,6 +562,9 @@ create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) { else { intclient = clnt; result.error = 0; +#ifdef DEBUG + printf("Client created\n"); +#endif } } return &result; |