network: rename pingId to payload

This commit is contained in:
Bixilon 2023-02-12 20:05:31 +01:00
parent fe27ee090e
commit a2a863ae53
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
4 changed files with 11 additions and 13 deletions

View File

@ -21,18 +21,16 @@ import de.bixilon.minosoft.util.logging.LogLevels
import de.bixilon.minosoft.util.logging.LogMessageType
@LoadPacket
class PongC2SP(
val id: Int,
) : PlayC2SPacket {
class PongC2SP(val payload: Int) : PlayC2SPacket {
override fun write(buffer: PlayOutByteBuffer) {
buffer.writeInt(id)
buffer.writeInt(payload)
}
override fun log(reducedLog: Boolean) {
if (reducedLog) {
return
}
Log.log(LogMessageType.NETWORK_PACKETS_OUT, LogLevels.VERBOSE) { "Pong (id=$id)" }
Log.log(LogMessageType.NETWORK_PACKETS_OUT, LogLevels.VERBOSE) { "Pong (payload=$payload)" }
}
}

View File

@ -21,13 +21,13 @@ import de.bixilon.minosoft.util.logging.LogLevels
import de.bixilon.minosoft.util.logging.LogMessageType
@LoadPacket(state = ProtocolStates.STATUS)
class PingC2SP(val pingId: Long) : C2SPacket {
class PingC2SP(val payload: Long) : C2SPacket {
override fun write(buffer: OutByteBuffer) {
buffer.writeLong(pingId)
buffer.writeLong(payload)
}
override fun log(reducedLog: Boolean) {
Log.log(LogMessageType.NETWORK_PACKETS_OUT, LogLevels.VERBOSE) { "Status ping (pingId=$pingId)" }
Log.log(LogMessageType.NETWORK_PACKETS_OUT, LogLevels.VERBOSE) { "Status ping (payload=$payload)" }
}
}

View File

@ -24,16 +24,16 @@ import de.bixilon.minosoft.util.logging.LogMessageType
@LoadPacket
class PingS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
val id = buffer.readInt()
val payload = buffer.readInt()
override fun handle(connection: PlayConnection) {
connection.sendPacket(PongC2SP(id))
connection.sendPacket(PongC2SP(payload))
}
override fun log(reducedLog: Boolean) {
if (reducedLog) {
return
}
Log.log(LogMessageType.NETWORK_PACKETS_IN, LogLevels.VERBOSE) { "Ping (id=$id)" }
Log.log(LogMessageType.NETWORK_PACKETS_IN, LogLevels.VERBOSE) { "Ping (payload=$payload)" }
}
}

View File

@ -26,7 +26,7 @@ import de.bixilon.minosoft.util.logging.LogMessageType
@LoadPacket(state = ProtocolStates.STATUS)
class PongS2CP(buffer: InByteBuffer) : StatusS2CPacket {
val pingId: Long = buffer.readLong()
val payload: Long = buffer.readLong()
override fun handle(connection: StatusConnection) {
val ping = connection.ping ?: return
@ -37,6 +37,6 @@ class PongS2CP(buffer: InByteBuffer) : StatusS2CPacket {
}
override fun log(reducedLog: Boolean) {
Log.log(LogMessageType.NETWORK_PACKETS_IN, LogLevels.VERBOSE) { "Status pong (pingId=$pingId)" }
Log.log(LogMessageType.NETWORK_PACKETS_IN, LogLevels.VERBOSE) { "Status pong (payload=$payload)" }
}
}