Skip to content

Commit

Permalink
feat: log out disconnect reason with session statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
bbangert committed Aug 3, 2018
1 parent ef59d10 commit 1109aa2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::mem;
use std::rc::Rc;

use cadence::{prelude::*, StatsdClient};
use error_chain::ChainedError;
use futures::future::Either;
use futures::sync::mpsc;
use futures::sync::oneshot::Receiver;
Expand All @@ -17,6 +18,7 @@ use futures::{Async, Future, Poll, Sink, Stream};
use rusoto_dynamodb::UpdateItemOutput;
use state_machine_future::RentToOwn;
use tokio_core::reactor::Timeout;
use tungstenite::error::Error as ConnectionError;
use uuid::Uuid;
use woothee::parser::Parser;

Expand Down Expand Up @@ -447,12 +449,12 @@ where
fn poll_await_session_complete<'a>(
session_complete: &'a mut RentToOwn<'a, AwaitSessionComplete<T>>,
) -> Poll<AfterAwaitSessionComplete, Error> {
// xxx: handle error cases with maybe a log message?
let _error = {
let error = {
match session_complete.auth_state_machine.poll() {
Ok(Async::Ready(_)) => None,
Ok(Async::NotReady) => return Ok(Async::NotReady),
Err(e) => Some(e),
Err(Error(ErrorKind::Ws(ConnectionError::ConnectionClosed(_)), _)) => None,
Err(e) => Some(e.display_chain().to_string()),
}
};

Expand Down Expand Up @@ -532,6 +534,7 @@ where
"nacks" => stats.nacks,
"registers" => stats.registers,
"unregisters" => stats.unregisters,
"disconnect_reason" => error.unwrap_or("".to_string()),
);
transition!(UnAuthDone(()))
}
Expand Down

0 comments on commit 1109aa2

Please sign in to comment.