Avoid client_set_state on destroyed client
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 23 Apr 2010 11:54:21 +0000 (13:54 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 23 Apr 2010 11:54:21 +0000 (13:54 +0200)
Call client_set_state before connection_destroy because
connection_destroy might remove client (reference count 0).

src/connection.c

index e4c05f1..f1c19ec 100644 (file)
@@ -258,8 +258,8 @@ static void connection_handler(IOCHAN iochan, int event)
         {
             yaz_log(YLOG_WARN,  "connect timeout %s", client_get_url(cl));
 
-            connection_destroy(co);
             client_set_state(cl, Client_Error);
+            connection_destroy(co);
         }
         else if (client_get_state(co->client) == Client_Idle)
         {