From 9b00badf722d1e32f90ac4679c184f0870bf0b62 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 20 Apr 2010 13:10:22 +0200 Subject: [PATCH] Remove client_fatal. connection_destroy is static --- src/client.c | 8 -------- src/client.h | 1 - src/connection.c | 6 ++++-- src/connection.h | 1 - 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/client.c b/src/client.c index 146035c..a2fce08 100644 --- a/src/client.c +++ b/src/client.c @@ -153,14 +153,6 @@ void client_set_state(struct client *cl, enum client_state st) static void client_show_raw_error(struct client *cl, const char *addinfo); -// Close connection and set state to error -void client_fatal(struct client *cl) -{ - yaz_log(YLOG_WARN, "Fatal error from %s", client_get_url(cl)); - connection_destroy(cl->connection); - client_set_state(cl, Client_Error); -} - struct connection *client_get_connection(struct client *cl) { return cl->connection; diff --git a/src/client.h b/src/client.h index e746efa..767242e 100644 --- a/src/client.h +++ b/src/client.h @@ -50,7 +50,6 @@ void client_show_raw_remove(struct client *cl, void *rr); const char *client_get_state_str(struct client *cl); enum client_state client_get_state(struct client *cl); void client_set_state(struct client *cl, enum client_state st); -void client_fatal(struct client *cl); struct connection *client_get_connection(struct client *cl); struct session_database *client_get_database(struct client *cl); void client_set_database(struct client *cl, struct session_database *db); diff --git a/src/connection.c b/src/connection.c index f17e5da..5b4a127 100644 --- a/src/connection.c +++ b/src/connection.c @@ -106,7 +106,7 @@ static void remove_connection_from_host(struct connection *con) } // Close connection and recycle structure -void connection_destroy(struct connection *co) +static void connection_destroy(struct connection *co) { if (co->link) { @@ -256,7 +256,9 @@ static void connection_handler(IOCHAN iochan, int event) if (co->state == Conn_Connecting) { yaz_log(YLOG_WARN, "connect timeout %s", client_get_url(cl)); - client_fatal(cl); + + connection_destroy(co); + client_set_state(cl, Client_Error); } else if (client_get_state(co->client) == Client_Idle) { diff --git a/src/connection.h b/src/connection.h index 94ad85e..cb7f967 100644 --- a/src/connection.h +++ b/src/connection.h @@ -33,7 +33,6 @@ struct connection; struct host; struct session; -void connection_destroy(struct connection *co); void connect_resolver_host(struct host *host, iochan_man_t iochan); const char *connection_get_url(struct connection *co); void connection_release(struct connection *co); -- 1.7.10.4