lloesche / valheim-server-docker

Valheim dedicated gameserver with automatic update, World backup, BepInEx and ValheimPlus mod support
https://hub.docker.com/r/lloesche/valheim-server
Apache License 2.0
1.92k stars 269 forks source link

Fix server idle & server listening checks on crossplay-enabled servers #523

Closed recursiveGecko closed 1 year ago

recursiveGecko commented 1 year ago

Resolves #521, #515

lloesche commented 1 year ago

Hey, thanks for the PR. Question, does this still work with servers that are not using crossplay and are not public? I remember vaguely that non-public servers only ever listen on 2456 and never bind the query port.

recursiveGecko commented 1 year ago

Hi @lloesche, I verified that the server binds to both ports in the case you mentioned, but it doesn't actually seem to respond to queries.

> ss -ulp | egrep "245(6|7)"
UNCONN 1536   0            0.0.0.0:2457       0.0.0.0:*    users:(("valheim_server.",pid=181,fd=21))
UNCONN 0      0                  *:2456             *:*    users:(("valheim_server.",pid=181,fd=32))

This means that the original implementation worked correctly, but I've amended the server listening check anyway to include both ports - just to be safe.

I rebased my branch to include latest commits from main.

wcdanh2 commented 1 year ago

+1, This looks like a good solution.