This is to avoid closing connections uncleanly.
timeout_remove(&client->to_idle_output);
timeout_remove(&client->to_idle);
+ if (!client->hibernated && client->fd_in == client->fd_out)
+ (void)shutdown(client->fd_out, SHUT_RDWR);
/* i/ostreams are already closed at this stage, so fd can be closed */
fd_close_maybe_stdio(&client->fd_in, &client->fd_out);
i_stream_destroy(&conn->input);
o_stream_close(conn->output);
o_stream_destroy(&conn->output);
+ if (conn->fd_in == conn->fd_out)
+ (void)shutdown(conn->fd_out, SHUT_RDWR);
fd_close_maybe_stdio(&conn->fd_in, &conn->fd_out);
conn->disconnected = TRUE;
}
}
i_stream_close(client->input);
o_stream_close(client->output);
+ (void)shutdown(client->fd, SHUT_RDWR);
+
i_close_fd(&client->fd);
if (unref) {
i_assert(client->refcount > 1);
i_stream_destroy(&proxy->server_input);
o_stream_destroy(&proxy->server_output);
if (proxy->server_fd != -1) {
+ (void)shutdown(proxy->server_fd, SHUT_RDWR);
net_disconnect(proxy->server_fd);
proxy->server_fd = -1;
}
i_stream_destroy(&client->input);
o_stream_destroy(&client->output);
+ if (client->fd_in == client->fd_out)
+ (void)shutdown(client->fd_out, SHUT_RDWR);
fd_close_maybe_stdio(&client->fd_in, &client->fd_out);
/* Autoexpunging might run for a long time. Disconnect the client