X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=server%2Fseshigh.c;h=7e88771d0553c4598e29a9dca2a4aa210cb04148;hp=a062b3dd07f1b221ed2a11b681da5675fd0db869;hb=b22117b182e372c6d1adc77c7da6a1de508e8594;hpb=d09e17f371431d3397588e6b749219608d37766a diff --git a/server/seshigh.c b/server/seshigh.c index a062b3d..7e88771 100644 --- a/server/seshigh.c +++ b/server/seshigh.c @@ -4,7 +4,13 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: seshigh.c,v $ - * Revision 1.46 1995-08-29 11:17:58 quinn + * Revision 1.48 1995-10-06 08:51:20 quinn + * Added Write-buffer. + * + * 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 @@ -17,8 +23,6 @@ * Updated External * * Revision 1.42 1995/08/15 11:16:50 quinn - * CV:e ---------------------------------------------------------------------- - * CV:e ---------------------------------------------------------------------- * * Revision 1.41 1995/08/02 10:23:06 quinn * Smallish @@ -205,6 +209,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 +474,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; @@ -578,7 +585,7 @@ static int process_response(association *assoc, request *req, Z_APDU *res) /* * Handle init request. - * At the moment, we don't check the protocol version or the options + * At the moment, we don't check the options * anywhere else in the code - we just try not to do anything that would * break a naive client. We'll toss 'em into the association block when * we need them there. @@ -1239,3 +1246,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"); +}