From c10f5ecfbd81e3a9bda4cca310e13b066a520f4a Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 19 Feb 1996 15:41:53 +0000 Subject: [PATCH] Better log messages. Minor improvement of connect method. --- ir-tcl.c | 21 +++++++++++++-------- ir-tcl.h | 8 ++++++-- queue.c | 9 +++++++-- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/ir-tcl.c b/ir-tcl.c index 3cc1149..9eddd5f 100644 --- a/ir-tcl.c +++ b/ir-tcl.c @@ -5,7 +5,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: ir-tcl.c,v $ - * Revision 1.74 1996-02-05 17:58:03 adam + * Revision 1.75 1996-02-19 15:41:53 adam + * Better log messages. + * Minor improvement of connect method. + * + * Revision 1.74 1996/02/05 17:58:03 adam * Ported ir-tcl to use the beta releases of tcl7.5/tk4.1. * * Revision 1.73 1996/01/29 11:35:19 adam @@ -1022,8 +1026,6 @@ static int do_connect (void *obj, Tcl_Interp *interp, interp->result = "already connected"; return TCL_ERROR; } - if (ir_tcl_strdup (interp, &p->hostname, argv[2]) == TCL_ERROR) - return TCL_ERROR; if (!strcmp (p->comstackType, "tcpip")) { p->cs_link = cs_create (tcpip_type, CS_BLOCK, p->protocol_type); @@ -1057,6 +1059,8 @@ static int do_connect (void *obj, Tcl_Interp *interp, p->comstackType, NULL); return TCL_ERROR; } + if (ir_tcl_strdup (interp, &p->hostname, argv[2]) == TCL_ERROR) + return TCL_ERROR; #if IRTCL_GENERIC_FILES #ifdef WINDOWS p->csFile = Tcl_GetFile (cs_fileno(p->cs_link), TCL_WIN_SOCKET); @@ -1070,7 +1074,8 @@ static int do_connect (void *obj, Tcl_Interp *interp, do_disconnect (p, NULL, 2, NULL); return TCL_ERROR; } - logf(LOG_DEBUG, "cs_connect() returned %d", r); + logf(LOG_DEBUG, "cs_connect() returned %d fd=%d", r, + cs_fileno(p->cs_link)); p->eventType = "connect"; #if IRTCL_GENERIC_FILES ir_select_add (p->csFile, p); @@ -1119,6 +1124,7 @@ static int do_disconnect (void *obj, Tcl_Interp *interp, } if (p->hostname) { + logf(LOG_DEBUG, "Closing connection to %s", p->hostname); free (p->hostname); p->hostname = NULL; #if IRTCL_GENERIC_FILES @@ -1132,7 +1138,6 @@ static int do_disconnect (void *obj, Tcl_Interp *interp, odr_reset (p->odr_in); assert (p->cs_link); - logf(LOG_DEBUG, "Closing connection"); cs_close (p->cs_link); p->cs_link = NULL; #if IRTCL_GENERIC_FILES @@ -1772,7 +1777,7 @@ static int ir_obj_mk (ClientData clientData, Tcl_Interp *interp, } #endif - logf (LOG_DEBUG, "ir object create"); + logf (LOG_DEBUG, "ir object create %s", argv[1]); obj->odr_in = odr_createmem (ODR_DECODE); obj->odr_out = odr_createmem (ODR_ENCODE); obj->odr_pr = odr_createmem (ODR_PRINT); @@ -3375,7 +3380,7 @@ void ir_select_read (ClientData clientData) Tcl_CmdInfo cmd_info; const char *apdu_call; - logf(LOG_DEBUG, "Read handler"); + logf(LOG_DEBUG, "Read handler fd=%d", cs_fileno(p->cs_link)); if (p->state == IR_TCL_R_Connecting) { logf(LOG_DEBUG, "Connect handler"); @@ -3545,7 +3550,7 @@ void ir_select_write (ClientData clientData) int r; IrTcl_Request *rq; - logf (LOG_DEBUG, "Write handler"); + logf (LOG_DEBUG, "Write handler fd=%d", cs_fileno(p->cs_link)); if (p->state == IR_TCL_R_Connecting) { logf(LOG_DEBUG, "Connect handler"); diff --git a/ir-tcl.h b/ir-tcl.h index 7e2db18..36fdf3a 100644 --- a/ir-tcl.h +++ b/ir-tcl.h @@ -24,7 +24,11 @@ * OF THIS SOFTWARE. * * $Log: ir-tcl.h,v $ - * Revision 1.12 1996-02-05 17:58:04 adam + * Revision 1.13 1996-02-19 15:41:54 adam + * Better log messages. + * Minor improvement of connect method. + * + * Revision 1.12 1996/02/05 17:58:04 adam * Ported ir-tcl to use the beta releases of tcl7.5/tk4.1. * * Revision 1.11 1995/09/21 13:11:52 adam @@ -63,7 +67,7 @@ #ifndef IR_TCL_H #define IR_TCL_H -#if TCL_MAJOR_VERSION > 7 || (TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 5) +#if 0 #define IRTCL_GENERIC_FILES 1 #else #define IRTCL_GENERIC_FILES 0 diff --git a/queue.c b/queue.c index c7b7439..a0ac72d 100644 --- a/queue.c +++ b/queue.c @@ -6,7 +6,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: queue.c,v $ - * Revision 1.6 1996-02-06 09:22:54 adam + * Revision 1.7 1996-02-19 15:41:55 adam + * Better log messages. + * Minor improvement of connect method. + * + * Revision 1.6 1996/02/06 09:22:54 adam * Ported ir-tcl to use beta releases of tcl7.5/tk4.1. * * Revision 1.5 1995/11/28 13:53:40 quinn @@ -95,7 +99,8 @@ int ir_tcl_send_q (IrTcl_Obj *p, IrTcl_Request *rp, const char *msg) } else { - logf (LOG_DEBUG, "Send %s (%d bytes)", msg, rp->len_out); + logf (LOG_DEBUG, "Send %s (%d bytes) fd=%d", msg, rp->len_out, + cs_fileno(p->cs_link)); p->state = IR_TCL_R_Waiting; free (rp->buf_out); rp->buf_out = NULL; -- 1.7.10.4