diff --git a/src/protocol/ftp/ftp.c b/src/protocol/ftp/ftp.c index 38a1aa5ca..c46c21ecb 100644 --- a/src/protocol/ftp/ftp.c +++ b/src/protocol/ftp/ftp.c @@ -1347,11 +1347,10 @@ out_of_mem: static void ftp_end_request(struct connection *conn, enum connection_state state) { - set_connection_state(conn, state); - - if (conn->state == S_OK && conn->cached) { + if (state == S_OK && conn->cached) { normalize_cache_entry(conn->cached, conn->from); } + set_connection_state(conn, state); add_keepalive_connection(conn, FTP_KEEPALIVE_TIMEOUT, NULL); } diff --git a/src/protocol/nntp/connection.c b/src/protocol/nntp/connection.c index 7a297cf66..2b95169cd 100644 --- a/src/protocol/nntp/connection.c +++ b/src/protocol/nntp/connection.c @@ -217,8 +217,6 @@ nntp_end_request(struct connection *conn, enum connection_state state) return; } - set_connection_state(conn, state); - if (conn->state == S_OK) { if (conn->cached) { normalize_cache_entry(conn->cached, conn->from); @@ -228,6 +226,7 @@ nntp_end_request(struct connection *conn, enum connection_state state) * grabing the keepalive connection will be able to go on. */ } + set_connection_state(conn, state); add_keepalive_connection(conn, NNTP_KEEPALIVE_TIMEOUT, nntp_quit); }