X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=queue.c;h=331fa1f977cd3635fe35f261095e9e70b8e7129e;hb=6b30d597fbae7be341e4b48056c72a2b0b8808f1;hp=a0ac72d282ea3ea6cb4e3fb2dbffa8e000347df6;hpb=c10f5ecfbd81e3a9bda4cca310e13b066a520f4a;p=ir-tcl-moved-to-github.git diff --git a/queue.c b/queue.c index a0ac72d..331fa1f 100644 --- a/queue.c +++ b/queue.c @@ -6,7 +6,21 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: queue.c,v $ - * Revision 1.7 1996-02-19 15:41:55 adam + * Revision 1.9 1996-03-20 13:54:05 adam + * The Tcl_File structure is only manipulated in the Tk-event interface + * in tkinit.c. + * + * Revision 1.8 1996/03/05 09:21:20 adam + * Bug fix: memory used by GRS records wasn't freed. + * Rewrote some of the error handling code - the connection is always + * closed before failback is called. + * If failback is defined the send APDU methods (init, search, ...) will + * return OK but invoke failback (as is the case if the write operation + * fails). + * Bug fix: ref_count in assoc object could grow if fraction of PDU was + * read. + * + * Revision 1.7 1996/02/19 15:41:55 adam * Better log messages. * Minor improvement of connect method. * @@ -70,8 +84,18 @@ int ir_tcl_send_APDU (Tcl_Interp *interp, IrTcl_Obj *p, Z_APDU *apdu, logf (LOG_DEBUG, "send_apdu. Sending %s", msg); if (ir_tcl_send_q (p, p->request_queue, msg) == TCL_ERROR) { - sprintf (interp->result, "cs_put failed in %s", msg); - return TCL_ERROR; + if (p->failback) + { + ir_tcl_disconnect (p); + p->failInfo = IR_TCL_FAIL_WRITE; + ir_tcl_eval (interp, p->failback); + return TCL_OK; + } + else + { + sprintf (interp->result, "cs_put failed in %s", msg); + return TCL_ERROR; + } } } else @@ -89,11 +113,7 @@ int ir_tcl_send_q (IrTcl_Obj *p, IrTcl_Request *rp, const char *msg) return TCL_ERROR; else if (r == 1) { -#if IRTCL_GENERIC_FILES - ir_select_add_write (p->csFile, p); -#else ir_select_add_write (cs_fileno (p->cs_link), p); -#endif logf (LOG_DEBUG, "Send part of %s", msg); p->state = IR_TCL_R_Writing; } @@ -112,6 +132,7 @@ void ir_tcl_del_q (IrTcl_Obj *p) { IrTcl_Request *rp, *rp1; + p->state = IR_TCL_R_Idle; for (rp = p->request_queue; rp; rp = rp1) { free (rp->object_name);