for (i=0; i<infos->len; i++) {
struct _refresh_info *r = &g_array_index(infos, struct _refresh_info, i);
- while (s_minfo && uid_cmp(camel_message_info_uid(s_minfo), r->uid, s) != 0) {
+ while (s_minfo && uid_cmp(camel_message_info_uid(s_minfo), r->uid, s) < 0) {
const gchar *uid = camel_message_info_uid (s_minfo);
camel_folder_change_info_remove_uid (job->u.refresh_info.changes, uid);
return is;
}
-/* Called with a connect lock */
static gboolean
imapx_disconnect (CamelIMAPXServer *is)
{
CAMEL_SERVICE_REC_LOCK (is->store, connect_lock);
g_static_rec_mutex_lock (&is->ostream_lock);
+ if (is->state == IMAPX_DISCONNECTED)
+ goto exit;
+
if (is->stream) {
if (camel_stream_close (is->stream->source) == -1)
ret = FALSE;
is->stream = NULL;
}
- is->state = IMAPX_DISCONNECTED;
-
if (is->select_folder) {
camel_object_unref(is->select_folder);
is->select_folder = NULL;
camel_imapx_command_free (is->literal);
is->literal = NULL;
}
-
+
+ is->state = IMAPX_DISCONNECTED;
+
+exit:
g_static_rec_mutex_unlock (&is->ostream_lock);
CAMEL_SERVICE_REC_UNLOCK (is->store, connect_lock);
if (imapx_idle_supported (is))
imapx_exit_idle (is);
+ CAMEL_SERVICE_REC_UNLOCK (is->store, connect_lock);
+
pthread_join (is->parser_thread_id, NULL);
- ret = TRUE;
+ return TRUE;
}
exit: