Skip to content

Commit

Permalink
Add package version to SERVER HELLO
Browse files Browse the repository at this point in the history
  • Loading branch information
ff14wed committed Jun 29, 2024
1 parent 195ef12 commit b4f9b1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ to the subscriber.
```c
// Deucalion: Connection established message.
Payload { OP: OP.Debug, CHANNEL: 9000, DATA: u8"SERVER HELLO. HOOK STATUS: RECV ON. SEND ON. SEND_LOBBY ON." }
Payload { OP: OP.Debug, CHANNEL: 9000, DATA: u8"SERVER HELLO. VERSION: 1.0.0. HOOK STATUS: RECV ON. SEND ON. SEND_LOBBY ON." }
// Deucalion: Data streamed to all subscribers
Payload { OP: OP.Recv, CHANNEL: 1, DATA: deucalion_segment }
...
Expand All @@ -251,7 +251,7 @@ Payload { OP: OP.Recv, CHANNEL: 1, DATA: deucalion_segment }
### Example when Deucalion requires sigs
```c
// Deucalion: Connection established message.
Payload { OP: OP.Debug, CHANNEL: 9000, DATA: u8"SERVER HELLO. HOOK STATUS: RECV OFF. SEND OFF. SEND_LOBBY OFF." }
Payload { OP: OP.Debug, CHANNEL: 9000, DATA: u8"SERVER HELLO. VERSION: 1.0.0. HOOK STATUS: RECV OFF. SEND OFF. SEND_LOBBY OFF." }
// Subscriber: Request with an invalid sig.
Payload { OP: OP.Recv, CHANNEL: 1, DATA: u8"invalid sig" }
// Deucalion: Response with an invalid sig error.
Expand All @@ -271,7 +271,7 @@ If the Recv hook is already initialized, then the following scenario can happen:
```c
// Deucalion: Connection established message.
Payload { OP: OP.Debug, CHANNEL: 9000, DATA: u8"SERVER HELLO. RECV ON. SEND ON. SEND_LOBBY ON." }
Payload { OP: OP.Debug, CHANNEL: 9000, DATA: u8"SERVER HELLO. VERSION: 1.0.0. RECV ON. SEND ON. SEND_LOBBY ON." }
// Deucalion: Data streamed to all subscribers
Payload { OP: OP.Recv, CHANNEL: 1, DATA: deucalion_segment }
Expand Down
10 changes: 7 additions & 3 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ impl State {

fn server_hello_string(&self) -> String {
format!(
"SERVER HELLO. HOOK STATUS: RECV {}. SEND {}. SEND_LOBBY {}.",
"SERVER HELLO. VERSION: {}. HOOK STATUS: RECV {}. SEND {}. SEND_LOBBY {}.",
crate::VERSION,
Self::hook_status_string(self.recv_hooked),
Self::hook_status_string(self.send_hooked),
Self::hook_status_string(self.send_lobby_hooked),
Expand Down Expand Up @@ -593,8 +594,11 @@ mod tests {

let fmt_msg = |a, b, c| {
format!(
"SERVER HELLO. HOOK STATUS: RECV {}. SEND {}. SEND_LOBBY {}.",
a, b, c
"SERVER HELLO. VERSION: {}. HOOK STATUS: RECV {}. SEND {}. SEND_LOBBY {}.",
crate::VERSION,
a,
b,
c
)
};
let combinations = vec![
Expand Down

0 comments on commit b4f9b1b

Please sign in to comment.