X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fzoom-c.c;h=7fd780dc4bcdab24e7391d6182bf0b542e65e539;hp=b53dceb69fc4c99e212b506b94ca0fb470298422;hb=871c6b4f403790572c3501ec68d8ea7d12e883f7;hpb=9021ba4aa6fcdbdd177073d44edd03a86d70198f diff --git a/src/zoom-c.c b/src/zoom-c.c index b53dceb..7fd780d 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -49,7 +49,6 @@ static void initlog(void) } } -void ZOOM_connection_remove_tasks(ZOOM_connection c); static zoom_ret send_HTTP_redirect(ZOOM_connection c, const char *uri); void ZOOM_set_dset_error(ZOOM_connection c, int error, @@ -84,7 +83,6 @@ void ZOOM_set_dset_error(ZOOM_connection c, int error, c, c->host_port ? c->host_port : "<>", dset, error, addinfo ? addinfo : "", addinfo2 ? addinfo2 : ""); - ZOOM_connection_remove_tasks(c); } } @@ -1082,6 +1080,8 @@ static zoom_ret do_connect_host(ZOOM_connection c, const char *logical_url) c->cs = cs_create_host2(logical_url, CS_FLAGS_DNS_NO_BLOCK, &add, c->tproxy ? c->tproxy : c->proxy, &c->proxy_mode); + if (!c->proxy) + c->proxy_mode = 0; if (c->cs && c->cs->protocol == PROTO_HTTP) { @@ -1677,22 +1677,26 @@ static int do_read(ZOOM_connection c) if (!z_GDU(c->odr_in, &gdu, 0, 0)) { - int x; - int err = odr_geterrorx(c->odr_in, &x); - char msg[100]; - const char *element = odr_getelement(c->odr_in); - yaz_snprintf(msg, sizeof(msg), - "ODR code %d:%d element=%s offset=%d", - err, x, element ? element : "", - odr_offset(c->odr_in)); - ZOOM_set_error(c, ZOOM_ERROR_DECODE, msg); - if (c->log_api) + /* even on failures we try to re-connect (HTTP) */ + if (!ZOOM_test_reconnect(c)) { - FILE *ber_file = yaz_log_file(); - if (ber_file) - odr_dumpBER(ber_file, c->buf_in, r); + int x; + int err = odr_geterrorx(c->odr_in, &x); + char msg[100]; + const char *element = odr_getelement(c->odr_in); + yaz_snprintf(msg, sizeof(msg), + "ODR code %d:%d element=%s offset=%d", + err, x, element ? element : "", + odr_offset(c->odr_in)); + ZOOM_set_error(c, ZOOM_ERROR_DECODE, msg); + if (c->log_api) + { + FILE *ber_file = yaz_log_file(); + if (ber_file) + odr_dumpBER(ber_file, c->buf_in, r); + } + ZOOM_connection_close(c); } - ZOOM_connection_close(c); } else {