From 237c74240feecedd4b4206eb4a447736cbcb5a9c Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 28 Jan 2013 23:34:18 +0900 Subject: Implement the abort behaviour as noted in the spec --- vxi11_server.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'vxi11_server.c') diff --git a/vxi11_server.c b/vxi11_server.c index 1bf7889..79ff9f7 100644 --- a/vxi11_server.c +++ b/vxi11_server.c @@ -49,6 +49,7 @@ typedef struct { int lid; int sock; GTimeVal lastactivity; + bool aborted; } ActiveLink; static ActiveLink* links[MAX_SESSIONS] = { NULL }; @@ -171,6 +172,7 @@ device_abort_1_svc(Device_Link *argp, struct svc_req *rqstp) { if (!isValidLink(*argp)) result.error = ERR_INVALIDLINKINDENTIFIER; else { + links[*argp]->aborted = true; result.error = 0; } return &result; @@ -241,6 +243,7 @@ device_write_1_svc(Device_WriteParms *argp, struct svc_req *rqstp) { result.error = ERR_IOTIMEOUT; else { touchlink(argp->lid); + links[argp->lid]->aborted = false; gchar* str = g_strndup(argp->data.data_val, argp->data.data_len); #ifdef DEBUG int n; @@ -290,6 +293,11 @@ device_read_1_svc(Device_ReadParms *argp, struct svc_req *rqstp) { else result.data.data_val = NULL; + if (links[argp->lid]->aborted) { + result.error = ERR_ABORT; + links[argp->lid]->aborted = false; + } + result.reason = 0x4; } return &result; -- cgit