i_unreached();
}
-int smtp_client_command_send_more(struct smtp_client_connection *conn)
+static int smtp_client_command_do_send_more(struct smtp_client_connection *conn)
{
struct smtp_client_command *cmd;
const char *data;
return 0;
}
+int smtp_client_command_send_more(struct smtp_client_connection *conn)
+{
+ int ret;
+
+ if ((ret=smtp_client_command_do_send_more(conn)) < 0)
+ return -1;
+
+ smtp_client_connection_update_cmd_timeout(conn);
+ return ret;
+}
+
static void
smtp_client_command_disconnected(struct smtp_client_connection *conn)
{
{
unsigned int msecs = conn->set.command_timeout_msecs;
- if (conn->state != SMTP_CLIENT_CONNECTION_STATE_READY) {
+ if (conn->state < SMTP_CLIENT_CONNECTION_STATE_READY) {
/* pre-login uses connect timeout */
return;
}
timeout_remove(&conn->to_commands);
return;
}
- if (conn->cmd_wait_list_head == NULL &&
- conn->cmd_send_queue_head == NULL) {
+ if (conn->cmd_wait_list_head == NULL && !conn->sending_command) {
/* no commands pending */
timeout_remove(&conn->to_commands);
return;
{
unsigned int msecs = conn->set.command_timeout_msecs;
- if (conn->state != SMTP_CLIENT_CONNECTION_STATE_READY) {
+ if (conn->state < SMTP_CLIENT_CONNECTION_STATE_READY) {
/* pre-login uses connect timeout */
return;
}
return;
}
- if (conn->cmd_wait_list_head == NULL &&
- conn->cmd_send_queue_head == NULL) {
+ if (conn->cmd_wait_list_head == NULL && !conn->sending_command) {
if (conn->to_commands != NULL) {
smtp_client_connection_debug(conn,
"No commands pending; stop timeout");