QR2: Clear message ack waker before adding to sleeper

This commit is contained in:
mkwcat 2024-01-31 22:02:54 -05:00
parent 93e6e8a8f0
commit 0cbf5e431c
No known key found for this signature in database
GPG Key ID: 7A505679CE9E7AA9
2 changed files with 11 additions and 2 deletions

View File

@ -120,6 +120,9 @@ func handleConnection(conn net.PacketConn, addr net.Addr, buffer []byte) {
case ClientMessageAckRequest:
logging.Info(moduleName, "Command:", aurora.Yellow("CLIENT_MESSAGE_ACK"))
mutex.Lock()
defer mutex.Unlock()
// In case ClientExploitReply is lost, this can be checked as well
// This would be sent either after the payload is downloaded, or the client is already patched
session.ExploitReceived = true
@ -135,8 +138,9 @@ func handleConnection(conn net.PacketConn, addr net.Addr, buffer []byte) {
conn.WriteTo(createResponseHeader(KeepAliveRequest, 0), addr)
mutex.Lock()
defer mutex.Unlock()
session.LastKeepAlive = time.Now().Unix()
mutex.Unlock()
return
case AvailableRequest:
@ -151,6 +155,9 @@ func handleConnection(conn net.PacketConn, addr net.Addr, buffer []byte) {
case ClientExploitReply:
logging.Info(moduleName, "Command:", aurora.Yellow("CLIENT_EXPLOIT_ACK"))
mutex.Lock()
defer mutex.Unlock()
session.ExploitReceived = true
if login := session.Login; login != nil {
login.NeedsExploit = false

View File

@ -241,11 +241,13 @@ func SendClientMessage(senderIP string, destSearchID uint64, message []byte) {
}
s := sleep.Sleeper{}
receiver.MessageAckWaker.Clear()
s.AddWaker(receiver.MessageAckWaker)
timeWaker := sleep.Waker{}
s.AddWaker(&timeWaker)
receiver.MessageAckWaker.Clear()
timeOutCount := 0
for {
time.AfterFunc(1*time.Second, func() {