From b97cf845ff16093734287a5e0411483d90978e9b Mon Sep 17 00:00:00 2001 From: outdead Date: Sun, 18 Oct 2020 18:51:25 +0300 Subject: [PATCH 1/2] Fix response for another request for Rust server --- CHANGELOG.md | 9 ++++++++- rcon.go | 15 ++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 679921d..3e5a6f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +## [v1.2.2] - 2020-10-18 +### Added +- Added one more workaround for Rust server. When sent command "Say" there is no response data from server +with packet.ID = SERVERDATA_EXECCOMMAND_ID, only previous console message that command was received with +packet.ID = -1, therefore, forcibly set packet.ID to SERVERDATA_EXECCOMMAND_ID. + ## [v1.2.1] - 2020-10-06 ### Added - Added authentication failed test. @@ -36,7 +42,8 @@ changed. ### Added - Initial implementation. -[Unreleased]: https://github.com/gorcon/rcon/compare/v1.2.1...HEAD +[Unreleased]: https://github.com/gorcon/rcon/compare/v1.2.2...HEAD +[v1.2.1]: https://github.com/gorcon/rcon/compare/v1.2.1...v1.2.2 [v1.2.1]: https://github.com/gorcon/rcon/compare/v1.2.0...v1.2.1 [v1.2.0]: https://github.com/gorcon/rcon/compare/v1.1.2...v1.2.0 [v1.1.2]: https://github.com/gorcon/rcon/compare/v1.0.0...v1.1.2 diff --git a/rcon.go b/rcon.go index f0c006e..c2766d8 100644 --- a/rcon.go +++ b/rcon.go @@ -251,13 +251,22 @@ func (c *Conn) read() (*Packet, error) { return packet, err } - // Workaround for Rust server. Rust rcon server responses packet with a - // type of 4 and the next packet is valid. It is undocumented, so skip - // packet and read next. + // Workaround for Rust server. + // Rust rcon server responses packet with a type of 4 and the next packet + // is valid. It is undocumented, so skip packet and read next. if packet.Type == 4 { if _, err := packet.ReadFrom(c.conn); err != nil { return packet, err } + + // One more workaround for Rust server. + // When sent command "Say" there is no response data from server with + // packet.ID = SERVERDATA_EXECCOMMAND_ID, only previous console message + // that command was received with packet.ID = -1, therefore, forcibly + // set packet.ID to SERVERDATA_EXECCOMMAND_ID. + if packet.ID == -1 { + packet.ID = SERVERDATA_EXECCOMMAND_ID + } } return packet, nil From 566e361706d9460c922b0a5ab971de6165a3cc56 Mon Sep 17 00:00:00 2001 From: outdead Date: Sun, 18 Oct 2020 18:53:16 +0300 Subject: [PATCH 2/2] Fix CHANGELOG --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e5a6f2..ec66eb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,7 +43,7 @@ changed. - Initial implementation. [Unreleased]: https://github.com/gorcon/rcon/compare/v1.2.2...HEAD -[v1.2.1]: https://github.com/gorcon/rcon/compare/v1.2.1...v1.2.2 +[v1.2.2]: https://github.com/gorcon/rcon/compare/v1.2.1...v1.2.2 [v1.2.1]: https://github.com/gorcon/rcon/compare/v1.2.0...v1.2.1 [v1.2.0]: https://github.com/gorcon/rcon/compare/v1.1.2...v1.2.0 [v1.1.2]: https://github.com/gorcon/rcon/compare/v1.0.0...v1.1.2