summaryrefslogtreecommitdiff
path: root/vxi11_server.c
diff options
context:
space:
mode:
Diffstat (limited to 'vxi11_server.c')
-rw-r--r--vxi11_server.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/vxi11_server.c b/vxi11_server.c
index 06a8c44..0944b60 100644
--- a/vxi11_server.c
+++ b/vxi11_server.c
@@ -213,6 +213,8 @@ destroy_link_1_svc(Device_Link *argp, struct svc_req *rqstp) {
return &result;
}
+static bool havechannel = false;
+
Device_Error *
create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) {
static Device_Error result;
@@ -221,17 +223,16 @@ create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) {
#ifdef DEBUG
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, ntohs(argp->hostPort));
+ printf("Client %s is asking for an interrupt connection on port %u\n", clientaddressstring, argp->hostPort);
#endif
- bool alreadyhavechannel = false;
- if (alreadyhavechannel) {
+ if (havechannel) {
result.error = ERR_CHANNELALREADYESTABLISHED;
}
else {
struct sockaddr_in clientaddr;
clientaddr.sin_family = AF_INET;
- clientaddr.sin_port = argp->hostPort;
+ clientaddr.sin_port = htons(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);
@@ -242,6 +243,7 @@ create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) {
result.error = ERR_CHANNELNOTESTABLISHED;
}
else {
+ havechannel = true;
result.error = 0;
}
}
@@ -252,21 +254,13 @@ Device_Error *
destroy_intr_chan_1_svc(void *argp, struct svc_req *rqstp) {
static Device_Error result;
printf("destroy_intr_chan_1_svc()\n");
- bool havechannel = false;
if (!havechannel) {
result.error = ERR_CHANNELNOTESTABLISHED;
}
else {
+ havechannel = false;
result.error = 0;
}
return &result;
}
-/**
- void *
- device_intr_srq_1_svc(Device_SrqParms *argp, struct svc_req *rqstp) {
- printf("device_intr_srq_1_svc()\n");
- static char * result;
- return (void *) &result;
- }
- **/