mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 10:55:01 -04:00
connection: use AtomicInteger for connection id
This commit is contained in:
parent
e3ea904716
commit
4026ee53f5
@ -24,11 +24,12 @@ import de.bixilon.minosoft.protocol.network.network.client.ClientNetwork
|
|||||||
import de.bixilon.minosoft.protocol.network.network.client.netty.NettyClient
|
import de.bixilon.minosoft.protocol.network.network.client.netty.NettyClient
|
||||||
import de.bixilon.minosoft.protocol.packets.c2s.C2SPacket
|
import de.bixilon.minosoft.protocol.packets.c2s.C2SPacket
|
||||||
import de.bixilon.minosoft.protocol.versions.Version
|
import de.bixilon.minosoft.protocol.versions.Version
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
|
|
||||||
abstract class Connection : AbstractEventMaster {
|
abstract class Connection : AbstractEventMaster {
|
||||||
val network: ClientNetwork = NettyClient(this)
|
val network: ClientNetwork = NettyClient(this)
|
||||||
val events = EventMaster(GlobalEventMaster)
|
val events = EventMaster(GlobalEventMaster)
|
||||||
val connectionId = lastConnectionId++
|
val connectionId = id.getAndIncrement()
|
||||||
var wasConnected = false
|
var wasConnected = false
|
||||||
open val version: Version? = null
|
open val version: Version? = null
|
||||||
|
|
||||||
@ -82,6 +83,6 @@ abstract class Connection : AbstractEventMaster {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
var lastConnectionId: Int = 0
|
private val id = AtomicInteger()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user