summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaniel <danieruru@gmail.com>2013-01-28 23:34:18 +0900
committerdaniel <danieruru@gmail.com>2013-01-28 23:34:18 +0900
commit237c74240feecedd4b4206eb4a447736cbcb5a9c (patch)
treed20e3fac38ca44ee0423b29601290eae7caa49c5
parentf0f08c6342122440361ae794fce9d7182e98afc8 (diff)
Implement the abort behaviour as noted in the spec
-rw-r--r--vxi11_server.c8
1 files changed, 8 insertions, 0 deletions
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;