Commit 201a4eb9 authored by Jim Nelson's avatar Jim Nelson

Cleans up a slight bug in the ClientConnection state machine

The bug has more to do with intentionality and logging then causing
and detectable problem.  Also improves reporting of solicited vs.
unsolicited mailbox notifications.
parent 5b468948
......@@ -157,7 +157,7 @@ public class Geary.Imap.ClientConnection {
new Geary.State.Mapping(State.DEIDLING, Event.SEND_IDLE, on_send_idle),
new Geary.State.Mapping(State.DEIDLING, Event.RECVD_STATUS_RESPONSE, on_idle_status_response),
new Geary.State.Mapping(State.DEIDLING, Event.RECVD_SERVER_DATA, on_idle_server_data),
new Geary.State.Mapping(State.DEIDLING, Event.RECVD_CONTINUATION_RESPONSE, on_bad_continuation),
new Geary.State.Mapping(State.DEIDLING, Event.RECVD_CONTINUATION_RESPONSE, on_dropped_continuation),
new Geary.State.Mapping(State.DEIDLING, Event.DISCONNECTED, on_disconnected),
new Geary.State.Mapping(State.DISCONNECTED, Event.SEND, on_no_proceed),
......@@ -579,6 +579,16 @@ public class Geary.Imap.ClientConnection {
return state;
private uint on_dropped_continuation(uint state, uint event, void *user, Object? object) {
// Continuation received while de-idling, this is due to prior IDLE finally catching up with
// the receive channel, ignore as the IDLE will be dropped momentarily from the "done"
// previously sent
Logging.debug(Logging.Flag.NETWORK, "[%s] Continuation received, dropped: %s", to_string(),
((ContinuationResponse) object).to_string());
return state;
private uint on_bad_continuation(uint state, uint event, void *user, Object? object) {
debug("[%s] Bad continuation received: %s", to_string(),
((ContinuationResponse) object).to_string());
......@@ -703,7 +703,7 @@ public class Geary.Imap.ClientSession {
Gee.ArrayList<ServerData>? to_remove = null;
foreach (ServerData data in params.cmd_response.server_data) {
UnsolicitedServerData? unsolicited = UnsolicitedServerData.from_server_data(data);
if (unsolicited != null && report_unsolicited_server_data(unsolicited)) {
if (unsolicited != null && report_unsolicited_server_data(unsolicited, "SOLICITED")) {
if (to_remove == null)
to_remove = new Gee.ArrayList<ServerData>();
......@@ -1130,32 +1130,32 @@ public class Geary.Imap.ClientSession {
return success;
private bool report_unsolicited_server_data(UnsolicitedServerData unsolicited) {
private bool report_unsolicited_server_data(UnsolicitedServerData unsolicited, string label) {
bool reported = false;
if (unsolicited.exists >= 0) {
debug("UNSOLICITED EXISTS %d", unsolicited.exists);
debug("%s EXISTS %d", label, unsolicited.exists);
reported = true;
if (unsolicited.recent >= 0) {
debug("UNSOLICITED RECENT %d", unsolicited.recent);
debug("%s RECENT %d", label, unsolicited.recent);
reported = true;
if (unsolicited.expunge != null) {
debug("UNSOLICITED EXPUNGE %s", unsolicited.expunge.to_string());
debug("%s EXPUNGE %s", label, unsolicited.expunge.to_string());
reported = true;
if (unsolicited.flags != null) {
debug("UNSOLICITED FLAGS %s", unsolicited.flags.to_string());
debug("%s FLAGS %s", label, unsolicited.flags.to_string());
reported = true;
......@@ -1246,7 +1246,7 @@ public class Geary.Imap.ClientSession {
private void on_received_unsolicited_server_data(UnsolicitedServerData unsolicited) {
report_unsolicited_server_data(unsolicited, "UNSOLICITED");
private void on_received_bad_response(RootParameters root, ImapError err) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment