melib/nntp: add nntp-trace feature
parent
89c90f224a
commit
b65934facc
|
@ -80,6 +80,7 @@ http-static = ["isahc", "isahc/static-curl"]
|
|||
imap = ["imap-codec", "tls"]
|
||||
jmap = ["http"]
|
||||
nntp = ["tls"]
|
||||
nntp-trace = ["nntp"]
|
||||
maildir = ["notify"]
|
||||
mbox = ["notify"]
|
||||
notmuch = []
|
||||
|
|
|
@ -79,10 +79,15 @@ impl NntpStream {
|
|||
|
||||
let stream = {
|
||||
let addr = lookup_ipv4(path, server_conf.server_port)?;
|
||||
AsyncWrapper::new(Connection::new_tcp(TcpStream::connect_timeout(
|
||||
&addr,
|
||||
std::time::Duration::new(16, 0),
|
||||
)?))?
|
||||
AsyncWrapper::new({
|
||||
let conn = Connection::new_tcp(TcpStream::connect_timeout(
|
||||
&addr,
|
||||
std::time::Duration::new(16, 0),
|
||||
)?);
|
||||
#[cfg(feature = "nntp-trace")]
|
||||
let conn = conn.trace(true);
|
||||
conn
|
||||
})?
|
||||
};
|
||||
let mut res = String::with_capacity(8 * 1024);
|
||||
let mut ret = Self {
|
||||
|
@ -170,10 +175,13 @@ impl NntpStream {
|
|||
}
|
||||
}
|
||||
}
|
||||
ret.stream = AsyncWrapper::new(Connection::new_tls(conn_result?))
|
||||
.chain_err_summary(|| {
|
||||
format!("Could not initiate TLS negotiation to {}.", path)
|
||||
})?;
|
||||
ret.stream = AsyncWrapper::new({
|
||||
let conn = Connection::new_tls(conn_result?);
|
||||
#[cfg(feature = "nntp-trace")]
|
||||
let conn = conn.trace(true);
|
||||
conn
|
||||
})
|
||||
.chain_err_summary(|| format!("Could not initiate TLS negotiation to {}.", path))?;
|
||||
}
|
||||
}
|
||||
//ret.send_command(
|
||||
|
|
Loading…
Reference in New Issue