diff --git a/crates/proto/UPSTREAM.md b/crates/proto/UPSTREAM.md index 50f0560..c6dfab0 100644 --- a/crates/proto/UPSTREAM.md +++ b/crates/proto/UPSTREAM.md @@ -74,3 +74,7 @@ against or offered back to upstream. `FiletransferHandle`; it now fails the transfer (`FiletransferFailed`). A transfer address of `0.0.0.0`/`::` means the server's own address. The return code and transfer id counters wrap instead of overflowing. +9. **TeamSpeak 6 times in milliseconds** (`ts-bookkeeping/build/message_parser.rs`, + "Voelin patch"). TeamSpeak 6 sends some times, e.g. `datetime` of `notifyfilelist`, + in milliseconds, which failed to parse and dropped the whole message (empty file + lists). Values from 10^11 on (year 5138 in seconds) are taken as milliseconds. diff --git a/crates/proto/ts-bookkeeping/build/message_parser.rs b/crates/proto/ts-bookkeeping/build/message_parser.rs index f1fc849..fb74f34 100644 --- a/crates/proto/ts-bookkeeping/build/message_parser.rs +++ b/crates/proto/ts-bookkeeping/build/message_parser.rs @@ -181,13 +181,18 @@ pub fn single_value_deserializer(field: &Field, rust_type: &str) -> String { panic!("Unknown original time type {} found.", field.type_s); } } + // Voelin patch: TeamSpeak 6 sends some times (e.g. `datetime` of + // `notifyfilelist`) in milliseconds; seconds past 10^11 (year 5138) + // are taken as milliseconds. "OffsetDateTime" => format!( - "OffsetDateTime::from_unix_timestamp( - val.parse().map_err(|e| ParseError::ParseInt {{ + "OffsetDateTime::from_unix_timestamp({{ + let t: i64 = val.parse().map_err(|e| ParseError::ParseInt {{ arg: \"{}\", value: val.to_string(), source: e, - }})?).map_err(|e| ParseError::ParseDate {{ + }})?; + if t.unsigned_abs() >= 100_000_000_000 {{ t / 1000 }} else {{ t }} + }}).map_err(|e| ParseError::ParseDate {{ arg: \"{}\", value: val.to_string(), source: e, diff --git a/dev/docker-compose.yml b/dev/docker-compose.yml index 514d88b..c607b58 100644 --- a/dev/docker-compose.yml +++ b/dev/docker-compose.yml @@ -46,11 +46,14 @@ services: TSSERVER_QUERY_SSH_ENABLED: 1 TSSERVER_QUERY_HTTP_ENABLED: 1 TSSERVER_QUERY_ALLOW_LIST: /etc/tsserver/query_ip_allowlist.txt + # Clients connect to the port the server announces, so it must be the + # published one (30033 is the TS3 server's). + TSSERVER_FILE_TRANSFER_PORT: 30034 ports: - "9988:9987/udp" # voice (mapped to 9988 so both servers can run) - "10022:10022" # SSH ServerQuery - "10080:10080" # HTTP WebQuery - - "30034:30033" # file transfer + - "30034:30034" # file transfer: the server announces its own port volumes: - ts6-data:/var/tsserver - ./query_ip_allowlist.txt:/etc/tsserver/query_ip_allowlist.txt:ro