Skip to content

Commit 0342bc0

Browse files
committed
Issue #87: [RCON] Add support for rust's undocumented packet type
Signed-off-by: Rafael Ibasco <[email protected]>
1 parent 676cf45 commit 0342bc0

File tree

6 files changed

+26
-14
lines changed

6 files changed

+26
-14
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
Changelog
22
-------------
3+
1.0.5 - Bug fixes/enhancements
4+
5+
- Fixed #87: Fixed invalid packet type exception thrown when executing commands on a Rust server
6+
37
1.0.4 - Bug fixes/enhancements
48

59
- Enhancement #80: Use daemon threads for the default executor

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
241241
<dependency>
242242
<groupId>com.ibasco.agql</groupId>
243243
<artifactId>agql</artifactId>
244-
<version>1.0.4</version>
244+
<version>1.0.5</version>
245245
</dependency>
246246
```
247247

@@ -251,7 +251,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
251251
<dependency>
252252
<groupId>com.ibasco.agql</groupId>
253253
<artifactId>agql-steam-master</artifactId>
254-
<version>1.0.4</version>
254+
<version>1.0.5</version>
255255
</dependency>
256256
```
257257

@@ -261,7 +261,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
261261
<dependency>
262262
<groupId>com.ibasco.agql</groupId>
263263
<artifactId>agql-source-query</artifactId>
264-
<version>1.0.4</version>
264+
<version>1.0.5</version>
265265
</dependency>
266266
```
267267

@@ -272,7 +272,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
272272
<dependency>
273273
<groupId>com.ibasco.agql</groupId>
274274
<artifactId>agql-source-log</artifactId>
275-
<version>1.0.4</version>
275+
<version>1.0.5</version>
276276
</dependency>
277277
```
278278

@@ -282,7 +282,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
282282
<dependency>
283283
<groupId>com.ibasco.agql</groupId>
284284
<artifactId>agql-source-rcon</artifactId>
285-
<version>1.0.4</version>
285+
<version>1.0.5</version>
286286
</dependency>
287287
```
288288

@@ -292,7 +292,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
292292
<dependency>
293293
<groupId>com.ibasco.agql</groupId>
294294
<artifactId>agql-steam-webapi</artifactId>
295-
<version>1.0.4</version>
295+
<version>1.0.5</version>
296296
</dependency>
297297
```
298298

@@ -302,7 +302,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
302302
<dependency>
303303
<groupId>com.ibasco.agql</groupId>
304304
<artifactId>agql-dota2-webapi</artifactId>
305-
<version>1.0.4</version>
305+
<version>1.0.5</version>
306306
</dependency>
307307
```
308308

@@ -312,7 +312,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
312312
<dependency>
313313
<groupId>com.ibasco.agql</groupId>
314314
<artifactId>agql-csgo-webapi</artifactId>
315-
<version>1.0.4</version>
315+
<version>1.0.5</version>
316316
</dependency>
317317
```
318318

@@ -324,7 +324,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
324324
<dependency>
325325
<groupId>com.ibasco.agql</groupId>
326326
<artifactId>agql-coc-webapi</artifactId>
327-
<version>1.0.4</version>
327+
<version>1.0.5</version>
328328
</dependency>
329329
```
330330

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
<!-- Properties -->
3232
<properties>
33-
<revision>1.0.4</revision>
33+
<revision>1.0.5</revision>
3434
<changelist>-SNAPSHOT</changelist>
3535
<sha1/>
3636
<maven.compiler.source>1.8</maven.compiler.source>

protocols/valve/source/rcon/src/main/java/com/ibasco/agql/protocols/valve/source/query/rcon/SourceRcon.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
public final class SourceRcon {
3636

3737
/** Constant <code>DEFAULT_THREAD_GROUP</code> */
38-
public static final ThreadGroup DEFAULT_THREAD_GROUP = Platform.creeateThreadGroup(SourceRcon.class);
38+
public static final ThreadGroup DEFAULT_THREAD_GROUP = Platform.createThreadGroup(SourceRcon.class);
3939

4040
/**
4141
* RCON Auth Request Header
@@ -57,6 +57,11 @@ public final class SourceRcon {
5757
*/
5858
public static final int RCON_TYPE_RESPONSE_VALUE = 0;
5959

60+
/**
61+
* RCON Response Value Header (Rust)
62+
*/
63+
public static final int RCON_TYPE_RESPONSE_VALUE_RUST = 0x4;
64+
6065
/**
6166
* A reserved request id representing a special rcon terminator packet
6267
*/
@@ -129,7 +134,7 @@ public static boolean isTerminatorId(int requestId) {
129134
*/
130135
public static boolean isResponseValuePacket(SourceRconPacket packet) {
131136
Objects.requireNonNull(packet, "Packet argument must not be null");
132-
return RCON_TYPE_RESPONSE_VALUE == packet.getType();
137+
return RCON_TYPE_RESPONSE_VALUE == packet.getType() || RCON_TYPE_RESPONSE_VALUE_RUST == packet.getType();
133138
}
134139

135140
/**
@@ -267,6 +272,9 @@ public static String getPacketTypeName(int type) {
267272
case RCON_TYPE_RESPONSE_VALUE: {
268273
return "SERVERDATA_RESPONSE_VALUE";
269274
}
275+
case RCON_TYPE_RESPONSE_VALUE_RUST: {
276+
return "SERVERDATA_RESPONSE_VALUE_RUST";
277+
}
270278
default: {
271279
return "Unknown";
272280
}

protocols/valve/source/rcon/src/main/java/com/ibasco/agql/protocols/valve/source/query/rcon/SourceRconMessenger.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
*
8686
* @author Rafael Luis Ibasco
8787
*/
88-
@SuppressWarnings("FieldCanBeLocal")
88+
@SuppressWarnings({"FieldCanBeLocal", "rawtypes"})
8989
@MessengerProperties(optionClass = SourceRconOptions.class)
9090
public final class SourceRconMessenger extends NettyMessenger<SourceRconRequest, SourceRconResponse> {
9191

protocols/valve/source/rcon/src/main/java/com/ibasco/agql/protocols/valve/source/query/rcon/packets/SourceRconPacketDecoder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public SourceRconPacket decode(ByteBuf in) throws PacketDecodeException {
9898
//Read and verify request type
9999
desc = StringUtils.rightPad("Valid packet type?", PAD_SIZE);
100100
int packetType = in.readIntLE();
101-
if (packetType != SourceRcon.RCON_TYPE_RESPONSE_AUTH && packetType != SourceRcon.RCON_TYPE_RESPONSE_VALUE) {
101+
if (packetType != SourceRcon.RCON_TYPE_RESPONSE_AUTH && packetType != SourceRcon.RCON_TYPE_RESPONSE_VALUE && packetType != SourceRcon.RCON_TYPE_RESPONSE_VALUE_RUST) {
102102
debug(ctx, " [ ] {} = NO (Actual: {})", desc, packetType);
103103
throw new PacketDecodeException("Invalid packet type: " + packetType);
104104
}

0 commit comments

Comments
 (0)