X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=ir-tcl.c;h=e4ee0473873c75a1c5563133361b2334bf22f4b6;hb=f28f018de9b648bf36af3de63c942cc3bcb53b6e;hp=d6e166610009822a80ceacdf2db66e89fd2eb6a5;hpb=b90b777cd7b6b064f573d1a4475cf0ab8c66e8d2;p=ir-tcl-moved-to-github.git diff --git a/ir-tcl.c b/ir-tcl.c index d6e1666..e4ee047 100644 --- a/ir-tcl.c +++ b/ir-tcl.c @@ -5,7 +5,13 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: ir-tcl.c,v $ - * Revision 1.88 1996-06-03 09:04:22 adam + * Revision 1.90 1996-06-27 14:21:00 adam + * Yet another Windows port. + * + * Revision 1.89 1996/06/11 15:27:15 adam + * Event type set to connect a little earlier in the do_connect function. + * + * Revision 1.88 1996/06/03 09:04:22 adam * Changed a few logf calls. * * Revision 1.87 1996/05/29 06:37:51 adam @@ -1095,13 +1101,13 @@ static int do_connect (void *obj, Tcl_Interp *interp, } if (ir_tcl_strdup (interp, &p->hostname, argv[2]) == TCL_ERROR) return TCL_ERROR; + p->eventType = "connect"; if ((r=cs_connect (p->cs_link, addr)) < 0) { interp->result = "connect fail"; ir_tcl_disconnect (p); return TCL_ERROR; } - p->eventType = "connect"; ir_select_add (cs_fileno (p->cs_link), p); if (r == 1) { @@ -3640,7 +3646,7 @@ static void ir_select_read (ClientData clientData) /* * ir_select_write: handle outgoing packages - not yet written. */ -static void ir_select_write (ClientData clientData) +static int ir_select_write (ClientData clientData) { IrTcl_Obj *p = clientData; int r; @@ -3654,7 +3660,7 @@ static void ir_select_write (ClientData clientData) if (r == 1) { logf (LOG_DEBUG, "cs_rcvconnect returned 1"); - return; + return 2; } p->state = IR_TCL_R_Idle; p->ref_count = 2; @@ -3669,16 +3675,16 @@ static void ir_select_write (ClientData clientData) ir_tcl_eval (p->interp, p->failback); } ir_obj_delete (p); - return; + return 2; } if (p->callback) ir_tcl_eval (p->interp, p->callback); ir_obj_delete (p); - return; + return 2; } rq = p->request_queue; if (!rq || !rq->buf_out) - return; + return 0; assert (rq); if ((r=cs_put (p->cs_link, rq->buf_out, rq->len_out)) < 0) { @@ -3702,14 +3708,20 @@ static void ir_select_write (ClientData clientData) free (rq->buf_out); rq->buf_out = NULL; } + return 1; } static void ir_select_notify (ClientData clientData, int r, int w, int e) { - if (r) + if (w) + { + if (!ir_select_write (clientData) && r) + ir_select_read (clientData); + } + else if (r) + { ir_select_read (clientData); - else if (w) - ir_select_write (clientData); + } } /* ------------------------------------------------------- */