--- src/ident/Ident.cc.orig 2012-12-10 04:53:26.000000000 -0500 +++ src/ident/Ident.cc 2012-12-21 12:47:02.000000000 -0500 @@ -72,10 +72,11 @@ static CTCB Timeout; static CNCB ConnectDone; static hash_table *ident_hash = NULL; static void ClientAdd(IdentStateData * state, IDCB * callback, void *callback_data); static void identCallback(IdentStateData * state, char *result); +static void Close_(IdentStateData * state); } // namespace Ident Ident::IdentConfig Ident::TheConfig; @@ -99,21 +100,26 @@ xfree(client); } } void -Ident::Close(const CommCloseCbParams ¶ms) +Ident::Close_(IdentStateData * state) { - IdentStateData *state = (IdentStateData *)params.data; identCallback(state, NULL); state->conn->close(); hash_remove_link(ident_hash, (hash_link *) state); xfree(state->hash.key); cbdataFree(state); } void +Ident::Close(const CommCloseCbParams ¶ms) +{ + Ident::Close_((IdentStateData *)params.data); +} + +void Ident::Timeout(const CommTimeoutCbParams &io) { debugs(30, 3, HERE << io.conn); io.conn->close(); } @@ -125,15 +131,18 @@ if (status != COMM_OK) { if (status == COMM_TIMEOUT) { debugs(30, 3, "IDENT connection timeout to " << state->conn->remote); } + Ident::Close_(state); return; } assert(conn != NULL && conn == state->conn); + comm_add_close_handler(conn->fd, Ident::Close, state); + /* * see if any of our clients still care */ IdentClient *c; for (c = state->clients; c; c = c->next) { @@ -145,12 +154,10 @@ /* no clients care */ conn->close(); return; } - comm_add_close_handler(conn->fd, Ident::Close, state); - MemBuf mb; mb.init(); mb.Printf("%d, %d\r\n", conn->remote.GetPort(), conn->local.GetPort());