X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fconnection.c;h=fbdaf797b19a0795677b5bb7b0acc485bea80f5f;hb=24ad8ea356d71c764af19897e2719670a94a3a05;hp=c5fb6710e559194db46dc6d2d202b8074633aba6;hpb=b414c6fc223434772ef8260a6f5d252e09feeaaa;p=pazpar2-moved-to-github.git diff --git a/src/connection.c b/src/connection.c index c5fb671..fbdaf79 100644 --- a/src/connection.c +++ b/src/connection.c @@ -246,10 +246,7 @@ static void non_block_events(struct connection *co) { struct client *cl = co->client; if (cl) - { - client_check_preferred_watch(cl); client_got_records(cl); - } } } @@ -336,6 +333,7 @@ static int connection_connect(struct connection *con, iochan_man_t iochan_man) const char *sru; const char *sru_version = 0; const char *value; + int r = 0; WRBUF w; struct session_database *sdb = client_get_database(con->client); @@ -426,12 +424,22 @@ static int connection_connect(struct connection *con, iochan_man_t iochan_man) con->state = Conn_Connecting; iochan_settimeout(con->iochan, con->operation_timeout); iochan_setdata(con->iochan, con); - iochan_add(iochan_man, con->iochan); - - client_set_state(con->client, Client_Connecting); + if (iochan_add(iochan_man, con->iochan)) + { + yaz_log(YLOG_FATAL, "Out of connections"); + iochan_destroy(con->iochan); + con->iochan = 0; + ZOOM_connection_destroy(con->link); + con->link = 0; + r = -1; + } + else + { + client_set_state(con->client, Client_Connecting); + } ZOOM_options_destroy(zoptions); wrbuf_destroy(w); - return 0; + return r; } // Ensure that client has a connection associated