mirror of
https://github.com/chatmail/core.git
synced 2026-05-09 01:46:30 +03:00
wip-commit which passes all tests with proper finalization
This commit is contained in:
@@ -393,19 +393,15 @@ class IOThreads:
|
|||||||
def imap_thread_run(self):
|
def imap_thread_run(self):
|
||||||
while not self._thread_quitflag:
|
while not self._thread_quitflag:
|
||||||
lib.dc_perform_imap_jobs(self._dc_context)
|
lib.dc_perform_imap_jobs(self._dc_context)
|
||||||
if self._thread_quitflag:
|
|
||||||
break
|
|
||||||
lib.dc_perform_imap_fetch(self._dc_context)
|
lib.dc_perform_imap_fetch(self._dc_context)
|
||||||
if self._thread_quitflag:
|
|
||||||
break
|
|
||||||
lib.dc_perform_imap_idle(self._dc_context)
|
lib.dc_perform_imap_idle(self._dc_context)
|
||||||
|
print("IMAP_THREAD finished")
|
||||||
|
|
||||||
def smtp_thread_run(self):
|
def smtp_thread_run(self):
|
||||||
while not self._thread_quitflag:
|
while not self._thread_quitflag:
|
||||||
lib.dc_perform_smtp_jobs(self._dc_context)
|
lib.dc_perform_smtp_jobs(self._dc_context)
|
||||||
if self._thread_quitflag:
|
|
||||||
break
|
|
||||||
lib.dc_perform_smtp_idle(self._dc_context)
|
lib.dc_perform_smtp_idle(self._dc_context)
|
||||||
|
print("SMTP_THREAD finished")
|
||||||
|
|
||||||
|
|
||||||
class EventLogger:
|
class EventLogger:
|
||||||
|
|||||||
36
src/imap.rs
36
src/imap.rs
@@ -472,16 +472,21 @@ impl Imap {
|
|||||||
fn unsetup_handle(&self, context: &Context) {
|
fn unsetup_handle(&self, context: &Context) {
|
||||||
info!(context, 0, "IMAP unsetup_handle starts");
|
info!(context, 0, "IMAP unsetup_handle starts");
|
||||||
// self.interrupt_idle();
|
// self.interrupt_idle();
|
||||||
let session = self.session.lock().unwrap().take();
|
/*
|
||||||
if session.is_some() {
|
{
|
||||||
match session.unwrap().close() {
|
let session = self.session.lock().unwrap().take();
|
||||||
Ok(_) => {}
|
info!(context, 0, "IMAP unsetup_handle step1");
|
||||||
Err(err) => {
|
if session.is_some() {
|
||||||
eprintln!("failed to close connection: {:?}", err);
|
match session.unwrap().close() {
|
||||||
|
Ok(_) => {}
|
||||||
|
Err(err) => {
|
||||||
|
eprintln!("failed to close connection: {:?}", err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info!(context, 0, "IMAP unsetup_handle2.");
|
*/
|
||||||
|
info!(context, 0, "IMAP unsetup_handle step 2.");
|
||||||
let stream = self.stream.write().unwrap().take();
|
let stream = self.stream.write().unwrap().take();
|
||||||
if stream.is_some() {
|
if stream.is_some() {
|
||||||
match stream.unwrap().shutdown(net::Shutdown::Both) {
|
match stream.unwrap().shutdown(net::Shutdown::Both) {
|
||||||
@@ -492,11 +497,13 @@ impl Imap {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
info!(context, 0, "IMAP unsetup_handle3.");
|
info!(context, 0, "IMAP unsetup_handle step 3.");
|
||||||
let mut cfg = self.config.write().unwrap();
|
{
|
||||||
cfg.selected_folder = None;
|
let mut cfg = self.config.write().unwrap();
|
||||||
cfg.selected_mailbox = None;
|
cfg.selected_folder = None;
|
||||||
info!(context, 0, "IMAP disconnected.",);
|
cfg.selected_mailbox = None;
|
||||||
|
}
|
||||||
|
info!(context, 0, "IMAP unsetup_handle step 4 (disconnected).",);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn free_connect_params(&self) {
|
fn free_connect_params(&self) {
|
||||||
@@ -581,9 +588,8 @@ impl Imap {
|
|||||||
);
|
);
|
||||||
info!(context, 0, "IMAP-capabilities:{}", caps_list);
|
info!(context, 0, "IMAP-capabilities:{}", caps_list);
|
||||||
|
|
||||||
let mut config = self.config.write().unwrap();
|
self.config.write().unwrap().can_idle = can_idle;
|
||||||
config.can_idle = can_idle;
|
self.config.write().unwrap().has_xlist = has_xlist;
|
||||||
config.has_xlist = has_xlist;
|
|
||||||
*self.connected.lock().unwrap() = true;
|
*self.connected.lock().unwrap() = true;
|
||||||
teardown = false;
|
teardown = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user