improved compatibility

This commit is contained in:
sose 2021-06-14 00:59:00 +00:00
parent 20a790f69c
commit 99a22376b9
1 changed files with 5 additions and 4 deletions

View File

@ -21,9 +21,10 @@ handle_packet() {
message="$(echo $packet | cut -f3 -d '|')" message="$(echo $packet | cut -f3 -d '|')"
address="$( address="$(
echo "$packet" \ echo "$packet" \
| cut -f2 -d '|' \ | cut -f2 -d '|' \
| cut -f3 -d ' ' | grep -Eo \
'(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}'
)" )"
address="$address/$docker_subnet_mask" address="$address/$docker_subnet_mask"
if [ "$message" = "DEAD" ] if [ "$message" = "DEAD" ]
@ -81,6 +82,6 @@ handle_packet() {
echo "game server listening on $PORT" echo "game server listening on $PORT"
while true while true
do do
packet=$(nc -w 1 -W 1 -vlp $PORT 2>&1) packet=$(nc -w 1 -W 1 -nvlp $PORT 2>&1)
handle_packet "$(echo "$packet" | head -n 3 | tr '\n' '|')" & handle_packet "$(echo "$packet" | head -n 3 | tr '\n' '|')" &
done done