Skip to content

Commit

Permalink
proto: make now explicit for Endpoint::connect()
Browse files Browse the repository at this point in the history
  • Loading branch information
djc authored and Ralith committed Aug 25, 2023
1 parent c2a54b9 commit 307d80b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion quinn-proto/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ impl Endpoint {
/// Initiate a connection
pub fn connect(
&mut self,
now: Instant,
config: ClientConfig,
remote: SocketAddr,
server_name: &str,
Expand Down Expand Up @@ -352,7 +353,7 @@ impl Endpoint {
remote,
local_ip: None,
},
Instant::now(),
now,
tls,
None,
config.transport,
Expand Down
2 changes: 1 addition & 1 deletion quinn-proto/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fn version_negotiate_client() {
true,
);
let (_, mut client_ch) = client
.connect(client_config(), server_addr, "localhost")
.connect(Instant::now(), client_config(), server_addr, "localhost")
.unwrap();
let now = Instant::now();
let opt_event = client.handle(
Expand Down
2 changes: 1 addition & 1 deletion quinn-proto/src/tests/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ impl Pair {
let _guard = span.enter();
let (client_ch, client_conn) = self
.client
.connect(config, self.server.addr, "localhost")
.connect(Instant::now(), config, self.server.addr, "localhost")
.unwrap();
self.client.connections.insert(client_ch, client_conn);
client_ch
Expand Down
6 changes: 5 additions & 1 deletion quinn/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ impl Endpoint {
} else {
addr
};
let (ch, conn) = endpoint.inner.connect(config, addr, server_name)?;

let (ch, conn) = endpoint
.inner
.connect(Instant::now(), config, addr, server_name)?;

let socket = endpoint.socket.clone();
Ok(endpoint
.connections
Expand Down

0 comments on commit 307d80b

Please sign in to comment.