Mercurial > dovecot > core-2.2
changeset 11516:67b8de25154c HEAD
lib-master: Try to send master status more reliably.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 09 Jun 2010 20:42:14 +0100 |
parents | e3d2d9427d3d |
children | 3fa10300c70c |
files | src/lib-master/master-service-private.h src/lib-master/master-service.c |
diffstat | 2 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-master/master-service-private.h Wed Jun 09 19:47:25 2010 +0100 +++ b/src/lib-master/master-service-private.h Wed Jun 09 20:42:14 2010 +0100 @@ -59,7 +59,6 @@ unsigned int initial_status_sent:1; unsigned int die_with_master:1; unsigned int call_avail_overflow:1; - unsigned int delay_status_updates:1; unsigned int config_path_is_default:1; };
--- a/src/lib-master/master-service.c Wed Jun 09 19:47:25 2010 +0100 +++ b/src/lib-master/master-service.c Wed Jun 09 20:42:14 2010 +0100 @@ -675,11 +675,8 @@ /* we are full. stop listening for now, unless overflow callback destroys one of the existing connections */ if (service->call_avail_overflow && - service->avail_overflow_callback != NULL) { - service->delay_status_updates = TRUE; + service->avail_overflow_callback != NULL) service->avail_overflow_callback(); - service->delay_status_updates = FALSE; - } if (service->master_status.available_count == 0) { master_service_io_listeners_remove(service); @@ -817,12 +814,14 @@ bool important_update; important_update = master_status_update_is_important(service); - if (service->master_status.pid == 0 || service->delay_status_updates || + if (service->master_status.pid == 0 || service->master_status.available_count == service->last_sent_status_avail_count) { /* a) closed, b) updating to same state */ if (service->to_status != NULL) timeout_remove(&service->to_status); + if (service->io_status_write != NULL) + io_remove(&service->io_status_write); return; } if (ioloop_time == service->last_sent_status_time && @@ -835,6 +834,8 @@ timeout_add(1000, master_status_update, service); } + if (service->io_status_write != NULL) + io_remove(&service->io_status_write); return; } @@ -843,7 +844,7 @@ ret = write(MASTER_STATUS_FD, &service->master_status, sizeof(service->master_status)); - if (ret > 0) { + if (ret == sizeof(service->master_status)) { /* success */ if (service->io_status_write != NULL) { /* delayed important update sent successfully */ @@ -853,9 +854,9 @@ service->last_sent_status_avail_count = service->master_status.available_count; service->initial_status_sent = TRUE; - } else if (ret == 0) { + } else if (ret >= 0) { /* shouldn't happen? */ - i_error("write(master_status_fd) returned 0"); + i_error("write(master_status_fd) returned %d", (int)ret); service->master_status.pid = 0; } else if (errno != EAGAIN) { /* failure */