X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=zoom%2Fzoom-c.c;h=907aa2d7b75d37801f8d779fcf841ee0670d25a4;hb=fe569a8399e6072e18d7059b8b5950df32cf014e;hp=51908f84067cee60405333f06f36bc94f67b68c9;hpb=69bcd68523a9a8da083faef16887100369152673;p=yaz-moved-to-github.git diff --git a/zoom/zoom-c.c b/zoom/zoom-c.c index 51908f8..907aa2d 100644 --- a/zoom/zoom-c.c +++ b/zoom/zoom-c.c @@ -1,5 +1,5 @@ /* - * $Id: zoom-c.c,v 1.1 2001-10-23 21:00:20 adam Exp $ + * $Id: zoom-c.c,v 1.2 2001-10-24 12:24:43 adam Exp $ * * ZOOM layer for C, connections, result sets, queries. */ @@ -409,7 +409,7 @@ void Z3950_resultset_records (Z3950_resultset r, Z3950_record *recs, Z3950_resultset_retrieve (r, force_present, start, count); if (force_present) { - int i; + size_t i; for (i = 0; i< *cnt; i++) recs[i] = Z3950_resultset_record_immediate (r, i+start); } @@ -432,15 +432,18 @@ static void do_connect (Z3950_connection c) if (c->cs) { - cs_connect (c->cs, add); - c->state = STATE_CONNECTING; - c->mask = Z3950_SELECT_READ | Z3950_SELECT_WRITE; - } - else - { - c->state = STATE_IDLE; - c->error = Z3950_ERROR_CONNECT; + int ret = cs_connect (c->cs, add); + yaz_log (LOG_DEBUG, "cs_connect returned %d", ret); + if (ret >= 0) + { + c->state = STATE_CONNECTING; + c->mask = Z3950_SELECT_READ | Z3950_SELECT_WRITE | Z3950_SELECT_EXCEPT; + return; + } } + c->event_pending = 1; + c->state = STATE_IDLE; + c->error = Z3950_ERROR_CONNECT; } int z3950_connection_socket(Z3950_connection c) @@ -1293,7 +1296,7 @@ int Z3950_connection_do_io(Z3950_connection c, int mask) { #if 0 int r = cs_look(c->cs); - yaz_log (LOG_LOG, "Z3950_connection_do_io c=%p mask=%d cs_look=%d", + yaz_log (LOG_DEBUG, "Z3950_connection_do_io c=%p mask=%d cs_look=%d", c, mask, r); if (r == CS_NONE) @@ -1303,7 +1306,7 @@ int Z3950_connection_do_io(Z3950_connection c, int mask) } else if (r == CS_CONNECT) { - yaz_log (LOG_LOG, "calling rcvconnect"); + yaz_log (LOG_DEBUG, "calling rcvconnect"); if (cs_rcvconnect (c->cs) < 0) { c->error = Z3950_ERROR_CONNECT; @@ -1351,7 +1354,7 @@ int Z3950_connection_do_io(Z3950_connection c, int mask) int Z3950_event (int no, Z3950_connection *cs) { struct timeval tv; - fd_set input, output; + fd_set input, output, except; int i, r; int max_fd = 0; @@ -1370,6 +1373,7 @@ int Z3950_event (int no, Z3950_connection *cs) FD_ZERO (&input); FD_ZERO (&output); + FD_ZERO (&except); r = 0; for (i = 0; i