mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +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):
|
||||
while not self._thread_quitflag:
|
||||
lib.dc_perform_imap_jobs(self._dc_context)
|
||||
if self._thread_quitflag:
|
||||
break
|
||||
lib.dc_perform_imap_fetch(self._dc_context)
|
||||
if self._thread_quitflag:
|
||||
break
|
||||
lib.dc_perform_imap_idle(self._dc_context)
|
||||
print("IMAP_THREAD finished")
|
||||
|
||||
def smtp_thread_run(self):
|
||||
while not self._thread_quitflag:
|
||||
lib.dc_perform_smtp_jobs(self._dc_context)
|
||||
if self._thread_quitflag:
|
||||
break
|
||||
lib.dc_perform_smtp_idle(self._dc_context)
|
||||
print("SMTP_THREAD finished")
|
||||
|
||||
|
||||
class EventLogger:
|
||||
|
||||
36
src/imap.rs
36
src/imap.rs
@@ -472,16 +472,21 @@ impl Imap {
|
||||
fn unsetup_handle(&self, context: &Context) {
|
||||
info!(context, 0, "IMAP unsetup_handle starts");
|
||||
// self.interrupt_idle();
|
||||
let session = self.session.lock().unwrap().take();
|
||||
if session.is_some() {
|
||||
match session.unwrap().close() {
|
||||
Ok(_) => {}
|
||||
Err(err) => {
|
||||
eprintln!("failed to close connection: {:?}", err);
|
||||
/*
|
||||
{
|
||||
let session = self.session.lock().unwrap().take();
|
||||
info!(context, 0, "IMAP unsetup_handle step1");
|
||||
if session.is_some() {
|
||||
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();
|
||||
if stream.is_some() {
|
||||
match stream.unwrap().shutdown(net::Shutdown::Both) {
|
||||
@@ -492,11 +497,13 @@ impl Imap {
|
||||
}
|
||||
}
|
||||
|
||||
info!(context, 0, "IMAP unsetup_handle3.");
|
||||
let mut cfg = self.config.write().unwrap();
|
||||
cfg.selected_folder = None;
|
||||
cfg.selected_mailbox = None;
|
||||
info!(context, 0, "IMAP disconnected.",);
|
||||
info!(context, 0, "IMAP unsetup_handle step 3.");
|
||||
{
|
||||
let mut cfg = self.config.write().unwrap();
|
||||
cfg.selected_folder = None;
|
||||
cfg.selected_mailbox = None;
|
||||
}
|
||||
info!(context, 0, "IMAP unsetup_handle step 4 (disconnected).",);
|
||||
}
|
||||
|
||||
fn free_connect_params(&self) {
|
||||
@@ -581,9 +588,8 @@ impl Imap {
|
||||
);
|
||||
info!(context, 0, "IMAP-capabilities:{}", caps_list);
|
||||
|
||||
let mut config = self.config.write().unwrap();
|
||||
config.can_idle = can_idle;
|
||||
config.has_xlist = has_xlist;
|
||||
self.config.write().unwrap().can_idle = can_idle;
|
||||
self.config.write().unwrap().has_xlist = has_xlist;
|
||||
*self.connected.lock().unwrap() = true;
|
||||
teardown = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user