Skip to content

update deps #2107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,179 changes: 678 additions & 501 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ email = { git = "https://github.com/deltachat/rust-email", branch = "master" }
lettre_email = { git = "https://github.com/deltachat/lettre", branch = "master" }
async-imap = "0.4.0"
async-native-tls = { version = "0.3.3" }
async-std = { version = "1.6.4", features = ["unstable"] }
async-std = { version = "~1.8.0", features = ["unstable"] }
base64 = "0.12"
charset = "0.1"
percent-encoding = "2.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/repl/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ async fn start(args: Vec<String>) -> Result<(), Error> {
.output_stream(OutputStreamType::Stdout)
.build();
let mut selected_chat = ChatId::default();
let (reader_s, reader_r) = async_std::sync::channel(100);
let (reader_s, reader_r) = async_std::channel::bounded(100);
let input_loop = async_std::task::spawn_blocking(move || {
let h = DcHelper {
completer: FilenameCompleter::new(),
Expand All @@ -322,7 +322,7 @@ async fn start(args: Vec<String>) -> Result<(), Error> {
Ok(line) => {
// TODO: ignore "set mail_pw"
rl.add_history_entry(line.as_str());
async_std::task::block_on(reader_s.send(line));
async_std::task::block_on(reader_s.send(line)).unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This SendError shouldn't happen because the channel should never be closed, but I'd rather print the error instead of panic here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't happen, and it is just the repl, which is why an unwrap seems appropriate to me here

}
Err(ReadlineError::Interrupted) | Err(ReadlineError::Eof) => {
println!("Exiting...");
Expand Down
2 changes: 1 addition & 1 deletion src/configure/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ async fn configure(ctx: &Context, param: &mut LoginParam) -> Result<()> {
progress!(ctx, 600);

// Configure IMAP
let (_s, r) = async_std::sync::channel(1);
let (_s, r) = async_std::channel::bounded(1);
let mut imap = Imap::new(r);

let mut imap_configured = false;
Expand Down
22 changes: 12 additions & 10 deletions src/context.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
//! Context module

use std::collections::{BTreeMap, HashMap};
use std::ffi::OsString;
use std::ops::Deref;
use std::{
collections::{BTreeMap, HashMap},
time::Instant,
};
use std::time::{Instant, SystemTime};

use anyhow::{bail, ensure, Result};
use async_std::path::{Path, PathBuf};
use async_std::sync::{channel, Arc, Mutex, Receiver, RwLock, Sender};
use async_std::task;
use async_std::{
channel::{self, Receiver, Sender},
path::{Path, PathBuf},
sync::{Arc, Mutex, RwLock},
task,
};

use crate::chat::{get_chat_cnt, ChatId};
use crate::config::Config;
Expand All @@ -24,7 +25,6 @@ use crate::message::{self, MsgId};
use crate::scheduler::Scheduler;
use crate::securejoin::Bob;
use crate::sql::Sql;
use std::time::SystemTime;

#[derive(Clone, Debug)]
pub struct Context {
Expand Down Expand Up @@ -222,7 +222,7 @@ impl Context {

s.ongoing_running = true;
s.shall_stop_ongoing = false;
let (sender, receiver) = channel(1);
let (sender, receiver) = channel::bounded(1);
s.cancel_sender = Some(sender);

Ok(receiver)
Expand All @@ -249,7 +249,9 @@ impl Context {
let s_a = &self.running_state;
let mut s = s_a.write().await;
if let Some(cancel) = s.cancel_sender.take() {
cancel.send(()).await;
if let Err(err) = cancel.send(()).await {
warn!(self, "could not cancel ongoing: {:?}", err);
}
}

if s.ongoing_running && !s.shall_stop_ongoing {
Expand Down
6 changes: 3 additions & 3 deletions src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use std::ops::Deref;

use async_std::channel::{self, Receiver, Sender, TrySendError};
use async_std::path::PathBuf;
use async_std::sync::{channel, Receiver, Sender, TrySendError};
use strum::EnumProperty;

use crate::chat::ChatId;
Expand All @@ -18,7 +18,7 @@ pub struct Events {

impl Default for Events {
fn default() -> Self {
let (sender, receiver) = channel(1_000);
let (sender, receiver) = channel::bounded(1_000);

Self { receiver, sender }
}
Expand All @@ -35,7 +35,7 @@ impl Events {
// try again
self.emit(event);
}
Err(TrySendError::Disconnected(_)) => {
Err(TrySendError::Closed(_)) => {
unreachable!("unable to emit event, channel disconnected");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/imap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use async_imap::{
error::Result as ImapResult,
types::{Capability, Fetch, Flag, Mailbox, Name, NameAttribute},
};
use async_std::channel::Receiver;
use async_std::prelude::*;
use async_std::sync::Receiver;
use num_traits::FromPrimitive;

use crate::constants::{
Expand Down
Loading