Skip to content

Commit

Permalink
Some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Stevenjin8 committed Jan 21, 2025
1 parent 2192d67 commit dff6c92
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 54 deletions.
43 changes: 0 additions & 43 deletions local-dev-setup.sh

This file was deleted.

2 changes: 0 additions & 2 deletions src/proxy/h2/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ use std::sync::atomic::{AtomicBool, AtomicU16, Ordering};
use std::sync::Arc;
use std::task::{Context, Poll};
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::net::TcpStream;
use tokio::sync::oneshot;
use tokio::sync::watch::Receiver;
use tokio_rustls::client::TlsStream;
use tracing::{debug, error, trace, warn, Instrument};

#[derive(Debug, Clone)]
Expand Down
9 changes: 4 additions & 5 deletions src/proxy/outbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
use std::net::{IpAddr, SocketAddr};
use std::sync::Arc;

use futures::AsyncWriteExt;
use futures_util::TryFutureExt;
use hyper::header::FORWARDED;
use std::time::Instant;
use tokio::io::{AsyncRead, AsyncWrite};

use tokio::net::TcpStream;
use tokio::sync::watch;
Expand All @@ -40,7 +38,6 @@ use crate::state::workload::{address::Address, NetworkAddress, Protocol, Workloa
use crate::state::ServiceResolutionMode;
use crate::{assertions, copy, proxy, socket};

use super::h2::client::spawn_connection;
use super::h2::TokioH2Stream;

pub struct Outbound {
Expand Down Expand Up @@ -222,8 +219,10 @@ impl OutboundConnection {
req: &Request,
connection_stats: &ConnectionResult,
) -> Result<(), Error> {
// Outer HBONE
let upgraded = Box::pin(self.send_hbone_request(remote_addr, req)).await?;

// Inner HBONE
let upgraded = TokioH2Stream::new(upgraded);
let inner_workload = pool::WorkloadKey {
src_id: req.source.identity(),
Expand All @@ -233,7 +232,7 @@ impl OutboundConnection {
};
let request = self.create_hbone_request(remote_addr, req);

let (conn_client, inner_upgraded, drain_tx, driver_task) = self
let (_conn_client, inner_upgraded, drain_tx, driver_task) = self
.pool
.send_request_unpooled(upgraded, &inner_workload, request)
.await?;
Expand All @@ -251,7 +250,7 @@ impl OutboundConnection {
// drain_tx.send(true).unwrap();
// tokio::time::sleep(std::time::Duration::from_secs(1)).await;
drain_tx.send(true).unwrap();
driver_task.await;
let _ = driver_task.await;
// this sleep is important, so we have a race condition somewhere
// tokio::time::sleep(std::time::Duration::from_secs(1)).await;
res
Expand Down
5 changes: 1 addition & 4 deletions src/proxy/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub struct WorkloadHBONEPool {
}

// PoolState is effectively the gnarly inner state stuff that needs thread/task sync, and should be wrapped in a Mutex.
pub struct PoolState {
struct PoolState {
pool_notifier: watch::Sender<bool>, // This is already impl clone? rustc complains that it isn't, tho
timeout_tx: watch::Sender<bool>, // This is already impl clone? rustc complains that it isn't, tho
// this is effectively just a convenience data type - a rwlocked hashmap with keying and LRU drops
Expand All @@ -83,9 +83,6 @@ struct ConnSpawner {

// Does nothing but spawn new conns when asked
impl ConnSpawner {
// creates new HBONE connection over existing stream.
// Useful for when we want the lifetime of the connection to be tied to the connection pool,
// but we don't want to pool the connection itself.
async fn new_unpooled_conn(
&self,
key: WorkloadKey,
Expand Down

0 comments on commit dff6c92

Please sign in to comment.