consolidate debug output
This commit is contained in:
parent
8b7a49d03a
commit
000f848dd0
4 changed files with 20 additions and 22 deletions
|
@ -36,7 +36,6 @@ impl<S: AsyncWrite> ClientAuth<S> {
|
|||
Box::new(Anonymous::new()),
|
||||
];
|
||||
|
||||
println!("stream_features: {}", stream.stream_features);
|
||||
let mech_names: Vec<String> =
|
||||
match stream.stream_features.get_child("mechanisms", Some(NS_XMPP_SASL)) {
|
||||
None =>
|
||||
|
@ -46,12 +45,12 @@ impl<S: AsyncWrite> ClientAuth<S> {
|
|||
.map(|mech_el| mech_el.content_str())
|
||||
.collect(),
|
||||
};
|
||||
println!("Offered mechanisms: {:?}", 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!("Selected mechanism: {:?}", name);
|
||||
println!("SASL mechanism selected: {:?}", name);
|
||||
let initial = try!(mech.initial());
|
||||
let mut this = ClientAuth {
|
||||
state: ClientAuthState::Invalid,
|
||||
|
@ -79,7 +78,6 @@ impl<S: AsyncWrite> ClientAuth<S> {
|
|||
);
|
||||
nonza.text(content.to_base64(base64::URL_SAFE));
|
||||
|
||||
println!("send {}", nonza);
|
||||
let send = stream.send(Packet::Stanza(nonza));
|
||||
|
||||
self.state = ClientAuthState::WaitSend(send);
|
||||
|
@ -97,7 +95,6 @@ impl<S: AsyncRead + AsyncWrite> Future for ClientAuth<S> {
|
|||
ClientAuthState::WaitSend(mut send) =>
|
||||
match send.poll() {
|
||||
Ok(Async::Ready(stream)) => {
|
||||
println!("send done");
|
||||
self.state = ClientAuthState::WaitRecv(stream);
|
||||
self.poll()
|
||||
},
|
||||
|
|
|
@ -31,10 +31,7 @@ impl<S: AsyncWrite> ClientBind<S> {
|
|||
// return the (probably // usable) stream immediately
|
||||
ClientBind::Unsupported(stream),
|
||||
Some(_) => {
|
||||
println!("Bind is supported!");
|
||||
|
||||
let iq = make_bind_request(stream.jid.resource.as_ref());
|
||||
println!("Send {}", iq);
|
||||
let send = stream.send(Packet::Stanza(iq));
|
||||
ClientBind::WaitSend(send)
|
||||
},
|
||||
|
|
|
@ -37,7 +37,6 @@ impl<S: AsyncRead + AsyncWrite> StartTlsClient<S> {
|
|||
"starttls".to_owned(), Some(NS_XMPP_TLS.to_owned()),
|
||||
vec![]
|
||||
);
|
||||
println!("send {}", nonza);
|
||||
let packet = Packet::Stanza(nonza);
|
||||
let send = xmpp_stream.send(packet);
|
||||
|
||||
|
@ -60,7 +59,6 @@ impl<S: AsyncRead + AsyncWrite> Future for StartTlsClient<S> {
|
|||
StartTlsClientState::SendStartTls(mut send) =>
|
||||
match send.poll() {
|
||||
Ok(Async::Ready(xmpp_stream)) => {
|
||||
println!("starttls sent");
|
||||
let new_state = StartTlsClientState::AwaitProceed(xmpp_stream);
|
||||
retry = true;
|
||||
(new_state, Ok(Async::NotReady))
|
||||
|
@ -75,7 +73,6 @@ impl<S: AsyncRead + AsyncWrite> Future for StartTlsClient<S> {
|
|||
Ok(Async::Ready(Some(Packet::Stanza(ref stanza))))
|
||||
if stanza.name == "proceed" =>
|
||||
{
|
||||
println!("* proceed *");
|
||||
let stream = xmpp_stream.stream.into_inner();
|
||||
let connect = TlsConnector::builder().unwrap()
|
||||
.build().unwrap()
|
||||
|
@ -96,7 +93,7 @@ impl<S: AsyncRead + AsyncWrite> Future for StartTlsClient<S> {
|
|||
StartTlsClientState::StartingTls(mut connect) =>
|
||||
match connect.poll() {
|
||||
Ok(Async::Ready(tls_stream)) => {
|
||||
println!("Got a TLS stream!");
|
||||
println!("TLS stream established");
|
||||
let start = XMPPStream::from_stream(tls_stream, self.jid.clone());
|
||||
let new_state = StartTlsClientState::Start(start);
|
||||
retry = true;
|
||||
|
|
|
@ -20,7 +20,6 @@ impl XMPPRoot {
|
|||
fn new(root: xml::StartTag) -> Self {
|
||||
let mut builder = xml::ElementBuilder::new();
|
||||
let mut attributes = HashMap::new();
|
||||
println!("root attributes: {:?}", root.attributes);
|
||||
for (name_ns, value) in root.attributes {
|
||||
match name_ns {
|
||||
(ref name, None) if name == "xmlns" =>
|
||||
|
@ -73,10 +72,13 @@ impl Decoder for XMPPCodec {
|
|||
type Error = Error;
|
||||
|
||||
fn decode(&mut self, buf: &mut BytesMut) -> Result<Option<Self::Item>, Self::Error> {
|
||||
println!("XMPPCodec.decode {:?}", buf.len());
|
||||
match from_utf8(buf.take().as_ref()) {
|
||||
Ok(s) =>
|
||||
self.parser.feed_str(s),
|
||||
Ok(s) => {
|
||||
if s.len() > 0 {
|
||||
println!("<< {}", s);
|
||||
self.parser.feed_str(s);
|
||||
}
|
||||
},
|
||||
Err(e) =>
|
||||
return Err(Error::new(ErrorKind::InvalidInput, e)),
|
||||
}
|
||||
|
@ -110,7 +112,7 @@ impl Decoder for XMPPCodec {
|
|||
match root.handle_event(event) {
|
||||
None => (),
|
||||
Some(Ok(stanza)) => {
|
||||
println!("stanza: {}", stanza);
|
||||
// Emit the stanza
|
||||
result = Some(Packet::Stanza(stanza));
|
||||
break
|
||||
},
|
||||
|
@ -151,13 +153,18 @@ impl Encoder for XMPPCodec {
|
|||
}
|
||||
write!(buf, ">\n").unwrap();
|
||||
|
||||
println!("Encode start to {}", buf);
|
||||
print!(">> {}", buf);
|
||||
write!(dst, "{}", buf)
|
||||
},
|
||||
Packet::Stanza(stanza) =>
|
||||
write!(dst, "{}", stanza),
|
||||
Packet::Text(text) =>
|
||||
write!(dst, "{}", xml::escape(&text)),
|
||||
Packet::Stanza(stanza) => {
|
||||
println!(">> {}", stanza);
|
||||
write!(dst, "{}", stanza)
|
||||
},
|
||||
Packet::Text(text) => {
|
||||
let escaped = xml::escape(&text);
|
||||
println!(">> {}", escaped);
|
||||
write!(dst, "{}", escaped)
|
||||
},
|
||||
// TODO: Implement all
|
||||
_ => Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue