Skip to content

Commit 804b03c

Browse files
committed
Send kick order on gpcm disconnect
1 parent 07ceab4 commit 804b03c

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

gpcm/main.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"os"
88
"strings"
9+
"time"
910
"wwfc/common"
1011
"wwfc/database"
1112
"wwfc/logging"
@@ -68,10 +69,9 @@ var (
6869
mutex = deadlock.Mutex{}
6970

7071
allowDefaultDolphinKeys bool
71-
config common.Config
72+
config common.Config
7273
)
7374

74-
7575
func StartServer(reload bool) {
7676
qr2.SetGPErrorCallback(func(pid uint32, reason string) {
7777
kickPlayer(pid, reason, resolveWWFCMessage(reason))
@@ -127,6 +127,21 @@ func CloseConnection(index uint64) {
127127

128128
logging.Notice(session.ModuleName, "Connection closed")
129129

130+
ip, _ := common.IPFormatToInt(session.RemoteAddr)
131+
kickInfo := []qr2.PIDIPPair{
132+
{
133+
PID: session.User.ProfileId,
134+
IP: uint32(ip),
135+
},
136+
}
137+
138+
// Defer by 3 seconds just in case!
139+
go func() {
140+
time.AfterFunc(3*time.Second, func() {
141+
qr2.OrderKickFromGroups(kickInfo)
142+
})
143+
}()
144+
130145
if session.LoggedIn {
131146
qr2.Logout(session.User.ProfileId)
132147
if session.QR2IP != 0 {

0 commit comments

Comments
 (0)