X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=server%2Fseshigh.c;h=a3e3807adc6499e850386563d50339ca224a6795;hb=9e1a8a0a598aef894f59fa8abe3ccb144a5294a8;hp=a062b3dd07f1b221ed2a11b681da5675fd0db869;hpb=42d681412ccbe0b710a78f672bad207ce5b50d60;p=yaz-moved-to-github.git diff --git a/server/seshigh.c b/server/seshigh.c index a062b3d..a3e3807 100644 --- a/server/seshigh.c +++ b/server/seshigh.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: seshigh.c,v $ - * Revision 1.46 1995-08-29 11:17:58 quinn + * Revision 1.47 1995-08-29 14:24:16 quinn + * Added second half of close-handshake + * + * Revision 1.46 1995/08/29 11:17:58 quinn * Added code to receive close * * Revision 1.45 1995/08/21 09:11:00 quinn @@ -205,6 +208,7 @@ static Z_APDU *response_searchRequest(association *assoc, request *reqb, static Z_APDU *process_presentRequest(association *assoc, request *reqb, int *fd); static Z_APDU *process_scanRequest(association *assoc, request *reqb, int *fd); +static void process_close(association *assoc, request *reqb); static FILE *apduf = 0; /* for use in static mode */ static statserv_options_block *control_block = 0; @@ -469,6 +473,8 @@ static int process_request(association *assoc) res = process_presentRequest(assoc, req, &fd); break; case Z_APDU_scanRequest: res = process_scanRequest(assoc, req, &fd); break; + case Z_APDU_close: + process_close(assoc, req); return 0; default: logf(LOG_WARN, "Bad APDU received"); return -1; @@ -1239,3 +1245,28 @@ static Z_APDU *process_scanRequest(association *assoc, request *reqb, int *fd) return &apdu; } + +static void process_close(association *assoc, request *reqb) +{ + Z_Close *req = reqb->request->u.close; + static char *reasons[] = + { + "finished", + "shutdown", + "systemProblem", + "costLimit", + "resources", + "securityViolation", + "protocolError", + "lackOfActivity", + "peerAbort", + "unspecified" + }; + + logf(LOG_LOG, "Got close, reason %s, message %s", + reasons[*req->closeReason], req->diagnosticInformation ? + req->diagnosticInformation : "NULL"); + if (assoc->version < 3) /* to make do_force respond with close */ + assoc->version = 3; + do_close(assoc, Z_Close_finished, "Association terminated by client"); +}