melib/smtp: use localhost in lieu of 127.0.0.1 for CI
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (push) Failing after 9m49s
Details
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (push) Failing after 9m49s
Details
parent
6e27edcb77
commit
8cb2a515e1
|
@ -55,7 +55,7 @@ pub const DEFAULT_SNOOZED_FLAG: &str = "💤";
|
|||
pub struct RowsState<T> {
|
||||
pub selection: HashMap<EnvelopeHash, bool>,
|
||||
pub row_updates: SmallVec<[EnvelopeHash; 8]>,
|
||||
/// [ref:FIXME]: env vec should have at least one element guaranteed
|
||||
// [ref:FIXME]: env vec should have at least one element guaranteed
|
||||
pub thread_to_env: HashMap<ThreadHash, SmallVec<[EnvelopeHash; 8]>>,
|
||||
pub env_to_thread: HashMap<EnvelopeHash, ThreadHash>,
|
||||
pub thread_order: HashMap<ThreadHash, usize>,
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
*/
|
||||
|
||||
pub mod utf7;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use std::{
|
||||
any::Any,
|
||||
borrow::Cow,
|
||||
|
@ -35,9 +33,9 @@ use std::{
|
|||
};
|
||||
|
||||
use futures::stream::Stream;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use super::email::{Envelope, EnvelopeHash, Flag};
|
||||
|
||||
use crate::{
|
||||
conf::AccountSettings,
|
||||
error::{Error, ErrorKind, Result},
|
||||
|
|
|
@ -25,7 +25,7 @@ use crate::{
|
|||
email::parser::BytesExt,
|
||||
error::*,
|
||||
utils::{
|
||||
connections::{lookup_ipv4, Connection},
|
||||
connections::{lookup_ip, Connection},
|
||||
futures::timeout,
|
||||
},
|
||||
LogLevel,
|
||||
|
@ -177,7 +177,7 @@ impl ImapStream {
|
|||
.build()
|
||||
.chain_err_kind(ErrorKind::Network(NetworkErrorKind::InvalidTLSConnection))?;
|
||||
|
||||
let addr = lookup_ipv4(path, server_conf.server_port)?;
|
||||
let addr = lookup_ip(path, server_conf.server_port)?;
|
||||
|
||||
let mut socket = AsyncWrapper::new({
|
||||
let conn = Connection::new_tcp(if let Some(timeout) = server_conf.timeout {
|
||||
|
@ -280,7 +280,7 @@ impl ImapStream {
|
|||
.chain_err_summary(|| format!("Could not initiate TLS negotiation to {}.", path))?
|
||||
}
|
||||
} else {
|
||||
let addr = lookup_ipv4(path, server_conf.server_port)?;
|
||||
let addr = lookup_ip(path, server_conf.server_port)?;
|
||||
AsyncWrapper::new({
|
||||
let conn = Connection::new_tcp(if let Some(timeout) = server_conf.timeout {
|
||||
TcpStream::connect_timeout(&addr, timeout)?
|
||||
|
|
|
@ -25,8 +25,7 @@ pub use self::backend::*;
|
|||
|
||||
mod stream;
|
||||
use std::{
|
||||
collections::hash_map::DefaultHasher,
|
||||
collections::HashMap,
|
||||
collections::{hash_map::DefaultHasher, HashMap},
|
||||
fs,
|
||||
hash::{Hash, Hasher},
|
||||
io::{BufReader, Read},
|
||||
|
|
|
@ -150,9 +150,6 @@ use crate::{
|
|||
};
|
||||
|
||||
extern crate notify;
|
||||
use futures::Stream;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use std::{
|
||||
collections::hash_map::HashMap,
|
||||
fs::File,
|
||||
|
@ -164,6 +161,9 @@ use std::{
|
|||
sync::{mpsc::channel, Arc, Mutex, RwLock},
|
||||
};
|
||||
|
||||
use futures::Stream;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use self::notify::{watcher, DebouncedEvent, RecursiveMode, Watcher};
|
||||
|
||||
pub mod write;
|
||||
|
|
|
@ -24,7 +24,7 @@ use crate::{
|
|||
email::parser::BytesExt,
|
||||
error::*,
|
||||
log,
|
||||
utils::connections::{lookup_ipv4, Connection},
|
||||
utils::connections::{lookup_ip, Connection},
|
||||
};
|
||||
extern crate native_tls;
|
||||
use std::{collections::HashSet, future::Future, pin::Pin, sync::Arc, time::Instant};
|
||||
|
@ -78,7 +78,7 @@ impl NntpStream {
|
|||
let path = &server_conf.server_hostname;
|
||||
|
||||
let stream = {
|
||||
let addr = lookup_ipv4(path, server_conf.server_port)?;
|
||||
let addr = lookup_ip(path, server_conf.server_port)?;
|
||||
AsyncWrapper::new({
|
||||
let conn = Connection::new_tcp(TcpStream::connect_timeout(
|
||||
&addr,
|
||||
|
|
|
@ -110,9 +110,7 @@ CREATE TABLE IF NOT EXISTS article (
|
|||
|
||||
#[cfg(not(feature = "sqlite3"))]
|
||||
mod inner {
|
||||
use crate::{
|
||||
backends::nntp::UID, email::Flag, EnvelopeHash, Error, ErrorKind, MailboxHash, Result,
|
||||
};
|
||||
use crate::{email::Flag, nntp::UID, EnvelopeHash, Error, ErrorKind, MailboxHash, Result};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Store;
|
||||
|
|
|
@ -82,7 +82,7 @@ use smol::{unblock, Async as AsyncWrapper};
|
|||
use crate::{
|
||||
email::{parser::BytesExt, Address, Envelope},
|
||||
error::{Error, Result, ResultIntoError},
|
||||
utils::connections::{lookup_ipv4, Connection},
|
||||
utils::connections::{lookup_ip, Connection},
|
||||
};
|
||||
|
||||
/// Kind of server security (StartTLS/TLS/None) the client should attempt
|
||||
|
@ -261,7 +261,7 @@ impl SmtpConnection {
|
|||
}
|
||||
let connector = connector.build()?;
|
||||
|
||||
let addr = lookup_ipv4(path, server_conf.port)?;
|
||||
let addr = lookup_ip(path, server_conf.port)?;
|
||||
let mut socket = {
|
||||
let conn = Connection::new_tcp(TcpStream::connect_timeout(
|
||||
&addr,
|
||||
|
@ -373,7 +373,7 @@ impl SmtpConnection {
|
|||
ret
|
||||
}
|
||||
SmtpSecurity::None => {
|
||||
let addr = lookup_ipv4(path, server_conf.port)?;
|
||||
let addr = lookup_ip(path, server_conf.port)?;
|
||||
let mut ret = AsyncWrapper::new({
|
||||
let conn = Connection::new_tcp(TcpStream::connect_timeout(
|
||||
&addr,
|
||||
|
@ -1108,7 +1108,7 @@ mod test {
|
|||
|
||||
use super::*;
|
||||
|
||||
const ADDRESS: &str = "127.0.0.1:8825";
|
||||
const ADDRESS: &str = "localhost:8825";
|
||||
#[derive(Debug, Clone)]
|
||||
enum Message {
|
||||
Helo,
|
||||
|
@ -1260,7 +1260,7 @@ mod test {
|
|||
|
||||
fn get_smtp_conf() -> SmtpServerConf {
|
||||
SmtpServerConf {
|
||||
hostname: "127.0.0.1".into(),
|
||||
hostname: "localhost".into(),
|
||||
port: 8825,
|
||||
envelope_from: "foo-chat@example.com".into(),
|
||||
auth: SmtpAuth::None,
|
||||
|
@ -1288,7 +1288,7 @@ mod test {
|
|||
let mut server = Server::new(handler2);
|
||||
|
||||
server
|
||||
.with_name("example.com")
|
||||
.with_name("test")
|
||||
.with_ssl(SslConfig::None)
|
||||
.unwrap()
|
||||
.with_addr(ADDRESS)
|
||||
|
|
|
@ -494,19 +494,23 @@ impl std::os::unix::io::AsRawFd for Connection {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn lookup_ipv4(host: &str, port: u16) -> crate::Result<std::net::SocketAddr> {
|
||||
pub fn lookup_ip(host: &str, port: u16) -> crate::Result<std::net::SocketAddr> {
|
||||
use std::net::ToSocketAddrs;
|
||||
|
||||
use crate::error::{Error, ErrorKind, NetworkErrorKind};
|
||||
|
||||
let addrs = (host, port).to_socket_addrs()?;
|
||||
for addr in addrs {
|
||||
if let std::net::SocketAddr::V4(_) = addr {
|
||||
if matches!(
|
||||
addr,
|
||||
std::net::SocketAddr::V4(_) | std::net::SocketAddr::V6(_)
|
||||
) {
|
||||
return Ok(addr);
|
||||
}
|
||||
}
|
||||
|
||||
Err(
|
||||
crate::error::Error::new(format!("Could not lookup address {}:{}", host, port)).set_kind(
|
||||
crate::error::ErrorKind::Network(crate::error::NetworkErrorKind::HostLookupFailed),
|
||||
),
|
||||
Error::new(format!("Could not lookup address {}:{}", host, port))
|
||||
.set_kind(ErrorKind::Network(NetworkErrorKind::HostLookupFailed)),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue