diff options
Diffstat (limited to 'vxi11_server.c')
-rw-r--r-- | vxi11_server.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/vxi11_server.c b/vxi11_server.c index e852855..2382966 100644 --- a/vxi11_server.c +++ b/vxi11_server.c @@ -33,6 +33,9 @@ static CLIENT* intclient = NULL; +static bool intenabled = false; +static char* inthandler = NULL; + typedef struct { } ActiveLink; @@ -122,6 +125,10 @@ create_link_1_svc(Create_LinkParms *argp, struct svc_req *rqstp) { break; } } + globals.Remote.vxi_connections++; +#ifdef DEBUG + printf("created link %d, %d active links\n", linkid, globals.Remote.vxi_connections); +#endif struct sockaddr_in sin; socklen_t len = sizeof(sin); @@ -129,7 +136,6 @@ create_link_1_svc(Create_LinkParms *argp, struct svc_req *rqstp) { result.error = 0; result.abortPort = ntohs(sin.sin_port); result.lid = linkid; - globals.Remote.vxi_connections++; } } return &result; @@ -327,7 +333,19 @@ device_enable_srq_1_svc(Device_EnableSrqParms *argp, struct svc_req *rqstp) { if (!isValidLink(argp->lid)) result.error = ERR_INVALIDLINKINDENTIFIER; else { + if (inthandler != NULL) + free(inthandler); + if (argp->enable) { + if (argp->handle.handle_val != NULL) { + inthandler = malloc(argp->handle.handle_len); + strncpy(inthandler, argp->handle.handle_val, argp->handle.handle_len); +#ifdef DEBUG + printf("Interrupt handle set to %s\n", inthandler); +#endif + } + } result.error = 0; + intenabled = argp->enable; } return &result; } @@ -360,14 +378,15 @@ destroy_link_1_svc(Device_Link *argp, struct svc_req *rqstp) { if (!isValidLink(lid)) result.error = ERR_INVALIDLINKINDENTIFIER; else { + globals.Remote.vxi_connections--; #ifdef DEBUG - printf("link %d destroyed\n", lid); + printf("link %d destroyed, %d active links\n", lid, globals.Remote.vxi_connections); #endif + result.error = 0; free(links[lid]); links[lid] = NULL; } - globals.Remote.vxi_connections--; return &result; } |