Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repositories {
}

dependencies {
protobuf("gg.grounds:library-grpc-contracts-player:0.6.0")
protobuf("gg.grounds:library-grpc-contracts-player:0.7.0")

testImplementation("org.junit.jupiter:junit-jupiter-api:5.13.4")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.13.4")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,20 @@ private constructor(
}
}

fun logout(playerId: UUID): PlayerLogoutReply {
/**
* [proxyId] scopes the delete to this proxy's own session: a logout that raced a proxy-to-proxy
* transfer must not remove the session the next proxy just created. Empty is legal (the service
* falls back to the old unconditional delete).
*/
fun logout(playerId: UUID, proxyId: String = ""): PlayerLogoutReply {
return try {
stub
.withDeadlineAfter(DEFAULT_TIMEOUT_MS, TimeUnit.MILLISECONDS)
.playerLogout(
PlayerLogoutRequest.newBuilder().setPlayerId(playerId.toString()).build()
PlayerLogoutRequest.newBuilder()
.setPlayerId(playerId.toString())
.setProxyId(proxyId)
.build()
)
} catch (e: StatusRuntimeException) {
errorLogoutReply(e.status.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class PlayerConnectionListener(
val name = event.player.username

return EventTask.async {
val result = playerPresenceService.logout(playerId) ?: return@async
val result = playerPresenceService.logout(playerId, proxyId()) ?: return@async
if (result.removed) {
logger.info(
"Player session logout completed (playerId={}, username={}, message={})",
Expand Down Expand Up @@ -181,7 +181,7 @@ class PlayerConnectionListener(
val online = proxy.getPlayer(playerId).isPresent
if (!shouldReleaseAbandonedLogin(pendingLogins, playerId, online)) return

val result = playerPresenceService.logout(playerId)
val result = playerPresenceService.logout(playerId, proxyId())
logger.info(
"Player session released after abandoned login (playerId={}, username={}, removed={})",
playerId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ class PlayerPresenceService : AutoCloseable {
}
}

fun logout(playerId: UUID): PlayerLogoutReply? {
fun logout(playerId: UUID, proxyId: String = ""): PlayerLogoutReply? {
return try {
client.logout(playerId)
client.logout(playerId, proxyId)
} catch (e: RuntimeException) {
null
}
Expand Down