X-Git-Url: http://git.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Fconnection.c;h=c2c4beadb638c2da3d31328e300ec5aad8db71d3;hb=cc9efe948e97e8f6f785bdd2e37a17ba0cce672d;hp=98a73e00bd7316057981bb565879e6b88f44cd23;hpb=9ed1240d68bb478538ebc353393a1dc83f31d45c;p=pazpar2-moved-to-github.git diff --git a/src/connection.c b/src/connection.c index 98a73e0..c2c4bea 100644 --- a/src/connection.c +++ b/src/connection.c @@ -333,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); @@ -423,12 +424,20 @@ 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"); + 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