mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 11:24:56 -04:00
network: rename pingId to payload
This commit is contained in:
parent
fe27ee090e
commit
a2a863ae53
@ -21,18 +21,16 @@ import de.bixilon.minosoft.util.logging.LogLevels
|
|||||||
import de.bixilon.minosoft.util.logging.LogMessageType
|
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||||
|
|
||||||
@LoadPacket
|
@LoadPacket
|
||||||
class PongC2SP(
|
class PongC2SP(val payload: Int) : PlayC2SPacket {
|
||||||
val id: Int,
|
|
||||||
) : PlayC2SPacket {
|
|
||||||
|
|
||||||
override fun write(buffer: PlayOutByteBuffer) {
|
override fun write(buffer: PlayOutByteBuffer) {
|
||||||
buffer.writeInt(id)
|
buffer.writeInt(payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun log(reducedLog: Boolean) {
|
override fun log(reducedLog: Boolean) {
|
||||||
if (reducedLog) {
|
if (reducedLog) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Log.log(LogMessageType.NETWORK_PACKETS_OUT, LogLevels.VERBOSE) { "Pong (id=$id)" }
|
Log.log(LogMessageType.NETWORK_PACKETS_OUT, LogLevels.VERBOSE) { "Pong (payload=$payload)" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,13 +21,13 @@ import de.bixilon.minosoft.util.logging.LogLevels
|
|||||||
import de.bixilon.minosoft.util.logging.LogMessageType
|
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||||
|
|
||||||
@LoadPacket(state = ProtocolStates.STATUS)
|
@LoadPacket(state = ProtocolStates.STATUS)
|
||||||
class PingC2SP(val pingId: Long) : C2SPacket {
|
class PingC2SP(val payload: Long) : C2SPacket {
|
||||||
|
|
||||||
override fun write(buffer: OutByteBuffer) {
|
override fun write(buffer: OutByteBuffer) {
|
||||||
buffer.writeLong(pingId)
|
buffer.writeLong(payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun log(reducedLog: Boolean) {
|
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)" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,16 +24,16 @@ import de.bixilon.minosoft.util.logging.LogMessageType
|
|||||||
|
|
||||||
@LoadPacket
|
@LoadPacket
|
||||||
class PingS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
|
class PingS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
|
||||||
val id = buffer.readInt()
|
val payload = buffer.readInt()
|
||||||
|
|
||||||
override fun handle(connection: PlayConnection) {
|
override fun handle(connection: PlayConnection) {
|
||||||
connection.sendPacket(PongC2SP(id))
|
connection.sendPacket(PongC2SP(payload))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun log(reducedLog: Boolean) {
|
override fun log(reducedLog: Boolean) {
|
||||||
if (reducedLog) {
|
if (reducedLog) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Log.log(LogMessageType.NETWORK_PACKETS_IN, LogLevels.VERBOSE) { "Ping (id=$id)" }
|
Log.log(LogMessageType.NETWORK_PACKETS_IN, LogLevels.VERBOSE) { "Ping (payload=$payload)" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import de.bixilon.minosoft.util.logging.LogMessageType
|
|||||||
|
|
||||||
@LoadPacket(state = ProtocolStates.STATUS)
|
@LoadPacket(state = ProtocolStates.STATUS)
|
||||||
class PongS2CP(buffer: InByteBuffer) : StatusS2CPacket {
|
class PongS2CP(buffer: InByteBuffer) : StatusS2CPacket {
|
||||||
val pingId: Long = buffer.readLong()
|
val payload: Long = buffer.readLong()
|
||||||
|
|
||||||
override fun handle(connection: StatusConnection) {
|
override fun handle(connection: StatusConnection) {
|
||||||
val ping = connection.ping ?: return
|
val ping = connection.ping ?: return
|
||||||
@ -37,6 +37,6 @@ class PongS2CP(buffer: InByteBuffer) : StatusS2CPacket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun log(reducedLog: Boolean) {
|
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)" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user