comment debug output

Astro created

Change summary

README.md             |  3 ++-
src/client/auth.rs    |  8 ++++----
src/client/mod.rs     |  2 +-
src/component/mod.rs  |  2 +-
src/happy_eyeballs.rs |  6 +++---
src/xmpp_codec.rs     | 10 +++++-----
6 files changed, 16 insertions(+), 15 deletions(-)

Detailed changes

README.md 🔗

@@ -1,8 +1,9 @@
 # TODO
 
 - [ ] minidom ns
+- [ ] replace debug output with log crate
 - [ ] customize tls verify?
 - [ ] Error type
 - [ ] unexpected event errors
-- [ ] doc
+- [x] doc
 - [ ] tests

src/client/auth.rs 🔗

@@ -47,12 +47,12 @@ impl<S: AsyncWrite> ClientAuth<S> {
                     .map(|mech_el| mech_el.text())
                     .collect(),
             };
-        println!("SASL mechanisms offered: {:?}", mech_names);
+        // println!("SASL mechanisms offered: {:?}", mech_names);
 
         for mut mech in mechs {
             let name = mech.name().to_owned();
             if mech_names.iter().any(|name1| *name1 == name) {
-                println!("SASL mechanism selected: {:?}", name);
+                // println!("SASL mechanism selected: {:?}", name);
                 let initial = mech.initial()?;
                 let mut this = ClientAuth {
                     state: ClientAuthState::Invalid,
@@ -120,8 +120,8 @@ impl<S: AsyncRead + AsyncWrite> Future for ClientAuth<S> {
                             Ok(Async::NotReady)
                         }
                     }
-                    Ok(Async::Ready(event)) => {
-                        println!("ClientAuth ignore {:?}", event);
+                    Ok(Async::Ready(_event)) => {
+                        // println!("ClientAuth ignore {:?}", _event);
                         Ok(Async::NotReady)
                     },
                     Ok(_) => {

src/client/mod.rs 🔗

@@ -87,7 +87,7 @@ impl Client {
                 }).and_then(|xmpp_stream| {
                     Self::bind(xmpp_stream)
                 }).and_then(|xmpp_stream| {
-                    println!("Bound to {}", xmpp_stream.jid);
+                    // println!("Bound to {}", xmpp_stream.jid);
                     Ok(xmpp_stream)
                 })
         )

src/component/mod.rs 🔗

@@ -63,7 +63,7 @@ impl Component {
                 }).and_then(move |xmpp_stream| {
                     Self::auth(xmpp_stream, password).expect("auth")
                 }).and_then(|xmpp_stream| {
-                    println!("Bound to {}", xmpp_stream.jid);
+                    // println!("Bound to {}", xmpp_stream.jid);
                     Ok(xmpp_stream)
                 })
         )

src/happy_eyeballs.rs 🔗

@@ -65,7 +65,7 @@ impl Future for Connecter {
                 for addr in srv_item.to_socket_addrs() {
                     self.connects.entry(addr)
                         .or_insert_with(|| {
-                            println!("Connect to {}", addr);
+                            // println!("Connect to {}", addr);
                             TcpStream::connect(&addr, handle)
                         });
                 }
@@ -87,8 +87,8 @@ impl Future for Connecter {
                     connected_stream = Some(tcp_stream);
                     false
                 },
-                Err(e) => {
-                    println!("{}", e);
+                Err(_e) => {
+                    // println!("{}", _e);
                     false
                 },
             }

src/xmpp_codec.rs 🔗

@@ -163,7 +163,7 @@ impl TokenSink for ParserSink {
             Token::EOFToken =>
                 self.push_queue(Packet::StreamEnd),
             Token::ParseError(s) => {
-                println!("ParseError: {:?}", s);
+                // println!("ParseError: {:?}", s);
                 self.push_queue(Packet::Error(Box::new(Error::new(ErrorKind::InvalidInput, (*s).to_owned()))))
             },
             _ => (),
@@ -226,7 +226,7 @@ impl Decoder for XMPPCodec {
         match from_utf8(buf1) {
             Ok(s) => {
                 if ! s.is_empty() {
-                    println!("<< {}", s);
+                    // println!("<< {}", s);
                     let tendril = FromIterator::from_iter(s.chars());
                     self.parser.feed(tendril);
                 }
@@ -246,7 +246,7 @@ impl Decoder for XMPPCodec {
                 return result;
             },
             Err(e) => {
-                println!("error {} at {}/{} in {:?}", e, e.valid_up_to(), buf1.len(), buf1);
+                // println!("error {} at {}/{} in {:?}", e, e.valid_up_to(), buf1.len(), buf1);
                 return Err(Error::new(ErrorKind::InvalidInput, e));
             },
         }
@@ -291,7 +291,7 @@ impl Encoder for XMPPCodec {
             Packet::Stanza(stanza) => {
                 stanza.write_to_inner(&mut EventWriter::new(WriteBytes::new(dst)))
                     .and_then(|_| {
-                        println!(">> {:?}", dst);
+                        // println!(">> {:?}", dst);
                         Ok(())
                     })
                     .map_err(|e| Error::new(ErrorKind::InvalidInput, format!("{}", e)))
@@ -299,7 +299,7 @@ impl Encoder for XMPPCodec {
             Packet::Text(text) => {
                 write_text(&text, dst)
                     .and_then(|_| {
-                        println!(">> {:?}", dst);
+                        // println!(">> {:?}", dst);
                         Ok(())
                     })
                     .map_err(|e| Error::new(ErrorKind::InvalidInput, format!("{}", e)))