#include "dsync-mailbox-export.h"
#include "dsync-brain-private.h"
-static const char *dsync_box_state_names[DSYNC_BOX_STATE_DONE+1] = {
+const char *dsync_box_state_names[DSYNC_BOX_STATE_DONE+1] = {
"mailbox",
"changes",
"mail_requests",
unsigned int failed:1;
};
+extern const char *dsync_box_state_names[DSYNC_BOX_STATE_DONE+1];
+
void dsync_brain_mailbox_trees_init(struct dsync_brain *brain);
void dsync_brain_send_mailbox_tree(struct dsync_brain *brain);
void dsync_brain_send_mailbox_tree_deletes(struct dsync_brain *brain);
*_brain = NULL;
+ if (dsync_ibc_has_timed_out(brain->ibc)) {
+ i_error("Timeout during state=%s%s",
+ dsync_state_names[brain->state],
+ brain->state != DSYNC_STATE_SYNC_MAILS ? "" :
+ t_strdup_printf(" (send=%s recv=%s)",
+ dsync_box_state_names[brain->box_send_state],
+ dsync_box_state_names[brain->box_recv_state]));
+ }
if (dsync_ibc_has_failed(brain->ibc) ||
brain->state != DSYNC_STATE_DONE)
brain->failed = TRUE;
void *io_context;
unsigned int failed:1;
+ unsigned int timeout:1;
};
#endif
{
i_error("dsync(%s): I/O has stalled, no activity for %u seconds",
ibc->name, DSYNC_IBC_STREAM_TIMEOUT_MSECS/1000);
+ ibc->ibc.timeout = TRUE;
dsync_ibc_stream_stop(ibc);
}
return ibc->failed;
}
+bool dsync_ibc_has_timed_out(struct dsync_ibc *ibc)
+{
+ return ibc->timeout;
+}
+
bool dsync_ibc_is_send_queue_full(struct dsync_ibc *ibc)
{
return ibc->v.is_send_queue_full(ibc);
void dsync_ibc_close_mail_streams(struct dsync_ibc *ibc);
bool dsync_ibc_has_failed(struct dsync_ibc *ibc);
+bool dsync_ibc_has_timed_out(struct dsync_ibc *ibc);
bool dsync_ibc_is_send_queue_full(struct dsync_ibc *ibc);
bool dsync_ibc_has_pending_data(struct dsync_ibc *ibc);