Skip to content

Commit

Permalink
chore: remove debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
gakonst committed Jan 28, 2020
1 parent 2d6ce9d commit 4442f5b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
1 change: 0 additions & 1 deletion crates/interledger-btp/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ where
.to_bytes(),
);

// TODO check that the response is a success before proceeding
// (right now we just assume they'll close the connection if the auth didn't work)
let result = connection // this just a stream
.send(auth_packet)
Expand Down
1 change: 0 additions & 1 deletion crates/interledger-btp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ mod client_server {
.build(),
})
.await;
dbg!(&res);
assert!(res.is_ok());
btp_service.close();
}
Expand Down
23 changes: 3 additions & 20 deletions crates/interledger-btp/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ where

// tx -> rx -> write -> our peer
// Responsible mainly for responding to Pings
// TODO: We must somehow figure out how to merge this stream with the incoming one
let write_to_ws = client_rx.map(Ok).forward(write).then(move |_| {
async move {
debug!(
"Finished forwarding to WebSocket stream for account: {}",
account_id
);
// When this is dropped, the read valve will close
drop(close_connection);
Ok::<(), ()>(())
}
Expand All @@ -190,8 +190,8 @@ where
)
};

// Close connections triggers
let read = valve.wrap(read);
// Close connections trigger
let read = valve.wrap(read); // close when `write_to_ws` calls `drop(connection)`
let read = self.stream_valve.wrap(read);
let read_from_ws = read.for_each(handle_message_fn).then(move |_| {
async move {
Expand All @@ -202,22 +202,6 @@ where
Ok::<(), ()>(())
}
});

// TODO: How can we drop the trigger when both the read and write spawn'ed futures
// have completed?
// let connections = self.connections.clone();
// let keep_connections_open = self.close_all_connections.clone();
// .then(move |_| {
// let _ = keep_connections_open;
// let mut connections = connections.write();
// connections.remove(&account_id);
// debug!(
// "WebSocket connection closed for account {} ({} connections still open)",
// account_id,
// connections.len()
// );
// future::ready(())
// });
tokio::spawn(read_from_ws);

// Send pings every PING_INTERVAL until the connection closes (when `drop(close_connection)` is called)
Expand Down Expand Up @@ -277,7 +261,6 @@ where
Err(reject) => Packet::Reject(reject),
};

// TODO: Is it OK to remove the results from here?
if let Some(connection) = connections_clone.clone().read().get(&account_id) {
let message = ilp_packet_to_ws_message(request_id, packet);
let _ = connection.unbounded_send(message).map_err(move |err| {
Expand Down

0 comments on commit 4442f5b

Please sign in to comment.