diff options
Diffstat (limited to 'vxi11_server.c')
-rw-r--r-- | vxi11_server.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/vxi11_server.c b/vxi11_server.c index 906613f..06a8c44 100644 --- a/vxi11_server.c +++ b/vxi11_server.c @@ -224,15 +224,41 @@ 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, ntohs(argp->hostPort)); #endif - result.error = 0; + bool alreadyhavechannel = false; + if (alreadyhavechannel) { + result.error = ERR_CHANNELALREADYESTABLISHED; + } + else { + struct sockaddr_in clientaddr; + clientaddr.sin_family = AF_INET; + clientaddr.sin_port = argp->hostPort; + clientaddr.sin_addr.s_addr = argp->hostAddr; + int sock = RPC_ANYSOCK; + CLIENT* clnt = clnttcp_create(&clientaddr, DEVICE_INTR, DEVICE_INTR_VERSION, &sock, 0, 0); + if (clnt == NULL) { +#ifdef DEBUG + printf("Couldn't create interrupt channel client\n"); +#endif + result.error = ERR_CHANNELNOTESTABLISHED; + } + else { + result.error = 0; + } + } return &result; } Device_Error * destroy_intr_chan_1_svc(void *argp, struct svc_req *rqstp) { - printf("destroy_intr_chan_1_svc()\n"); static Device_Error result; - result.error = 0; + printf("destroy_intr_chan_1_svc()\n"); + bool havechannel = false; + if (!havechannel) { + result.error = ERR_CHANNELNOTESTABLISHED; + } + else { + result.error = 0; + } return &result; } |