Skip to content

Commit

Permalink
Rework MGS internals to use SingleSp
Browse files Browse the repository at this point in the history
The changes include:

* Removal of `RecvHandler` and all its supporting machinery; instead of
  a monster tokio task reponsible for recv'ing on all sockets, pairing
  up request/response IDs, etc., we spawn a `SingleSp` task for each
  switch port that manages all communication on that port's socket.
* Removal of the `timeout` option to most SP calls. `SingleSp` already
  has inherent (configured) timeouts for retries. At the HTTP client
  level, the client can already establish its own timeouts (e.g., in the
  event the network connection between client and server goes down); we
  don't need separate timeouts for SP communications (which the client
  has no reason to know how to set).
* The serial console websocket handling has moved from
  `gateway-sp-comms` to `gateway`.
  • Loading branch information
jgallagher committed Aug 17, 2022
1 parent b48e395 commit 20ea79f
Show file tree
Hide file tree
Showing 25 changed files with 598 additions and 1,788 deletions.
21 changes: 0 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions gateway-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ use slog::o;
use slog::Drain;
use slog::Level;
use slog::Logger;
use std::borrow::Cow;
use std::net::IpAddr;
use std::net::ToSocketAddrs;
use std::time::Duration;
use tokio::io::AsyncReadExt;
use tokio::io::AsyncWriteExt;
use tokio::net::TcpStream;
use tokio::select;
use tokio_tungstenite::tungstenite::protocol::frame::coding::CloseCode;
use tokio_tungstenite::tungstenite::protocol::CloseFrame;
use tokio_tungstenite::tungstenite::Message;
use tokio_tungstenite::MaybeTlsStream;
use tokio_tungstenite::WebSocketStream;
Expand Down Expand Up @@ -281,6 +284,10 @@ async fn main() -> Result<()> {
match c {
None => {
// channel is closed
_ = ws.close(Some(CloseFrame {
code: CloseCode::Normal,
reason: Cow::Borrowed("client closed stdin"),
})).await;
break;
}
Some(c) => {
Expand Down
5 changes: 0 additions & 5 deletions gateway-sp-comms/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@ license = "MPL-2.0"

[dependencies]
futures = "0.3.21"
http = "0.2.7"
hyper = "0.14.20"
ringbuffer = "0.8"
serde = { version = "1.0", features = ["derive"] }
serde_with = "2.0.0"
thiserror = "1.0.32"
tokio-tungstenite = "0.17"
tokio-stream = "0.1.8"
usdt = "0.3.1"
uuid = "1.1.0"

gateway-messages = { path = "../gateway-messages", features = ["std"] }
omicron-common = { path = "../common" }
Expand Down
Loading

0 comments on commit 20ea79f

Please sign in to comment.