Skip to content

Commit 4cdf19f

Browse files
committed
Pass the socket address down to WebsocketHandler::accept.
1 parent f891104 commit 4cdf19f

File tree

8 files changed

+19
-6
lines changed

8 files changed

+19
-6
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66

77
### Fixed
88

9+
# 0.1.32
10+
11+
### Changed
12+
- **BREAKING**: Changed the signature of `WebsocketHandler::accept()` to also pass the connecting socket address down.
13+
14+
# 0.1.31
15+
16+
### Changed
17+
- Updated dependencies.
18+
919
# 0.1.30
1020

1121
### Fixed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ tracing = { version = "0.1", default-features = false, features = ["std"] }
3333
tracing-subscriber = "0.3"
3434
dashmap = "6.0.1"
3535

36-
hydra-macros = { version = "0.1.31", path = "./hydra-macros" }
37-
hydra = { version = "0.1.31", path = "./hydra", default-features = false }
36+
hydra-macros = { version = "0.1.32", path = "./hydra-macros" }
37+
hydra = { version = "0.1.32", path = "./hydra", default-features = false }
3838

3939
[profile.release]
4040
lto = "fat"

hydra-macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hydra-macros"
3-
version = "0.1.31"
3+
version = "0.1.32"
44
edition = "2021"
55
license.workspace = true
66
repository.workspace = true

hydra-websockets/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hydra-websockets"
3-
version = "0.1.31"
3+
version = "0.1.32"
44
edition = "2021"
55
readme = "./README.md"
66
license.workspace = true

hydra-websockets/examples/server.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ impl WebsocketHandler for MyWebsocketHandler {
2121
type Message = ();
2222

2323
fn accept(
24+
_address: SocketAddr,
2425
_request: &WebsocketRequest,
2526
response: WebsocketResponse,
2627
) -> Result<(WebsocketResponse, Self), ExitReason> {

hydra-websockets/src/websocket_handler.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::future::Future;
2+
use std::net::SocketAddr;
23

34
use futures_util::stream;
45
use futures_util::SinkExt;
@@ -34,6 +35,7 @@ where
3435
///
3536
/// You can extract information from the request and put it in your handler state.
3637
fn accept(
38+
address: SocketAddr,
3739
request: &WebsocketRequest,
3840
response: WebsocketResponse,
3941
) -> Result<(WebsocketResponse, Self), ExitReason>;

hydra-websockets/src/websocket_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ where
9999
let mut handler: Option<T> = None;
100100

101101
let callback = |request: &WebsocketRequest, response: WebsocketResponse| match T::accept(
102-
request, response,
102+
address, request, response,
103103
) {
104104
Ok((response, rhandler)) => {
105105
handler = Some(rhandler);

hydra/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hydra"
3-
version = "0.1.31"
3+
version = "0.1.32"
44
edition = "2021"
55
readme.workspace = true
66
license.workspace = true

0 commit comments

Comments
 (0)