fix DeleteSemaphore variable naming

This commit is contained in:
wish
2023-04-23 15:35:18 +10:00
parent d31b6a74e6
commit e04c18bccf
2 changed files with 3 additions and 4 deletions

View File

@@ -10,7 +10,7 @@ import (
// MsgSysDeleteSemaphore represents the MSG_SYS_DELETE_SEMAPHORE // MsgSysDeleteSemaphore represents the MSG_SYS_DELETE_SEMAPHORE
type MsgSysDeleteSemaphore struct { type MsgSysDeleteSemaphore struct {
AckHandle uint32 SemaphoreID uint32
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -20,7 +20,7 @@ func (m *MsgSysDeleteSemaphore) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgSysDeleteSemaphore) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgSysDeleteSemaphore) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.SemaphoreID = bf.ReadUint32()
return nil return nil
} }

View File

@@ -55,12 +55,11 @@ func releaseRaviSemaphore(s *Session, sema *Semaphore) {
func handleMsgSysDeleteSemaphore(s *Session, p mhfpacket.MHFPacket) { func handleMsgSysDeleteSemaphore(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgSysDeleteSemaphore) pkt := p.(*mhfpacket.MsgSysDeleteSemaphore)
sem := pkt.AckHandle
if s.server.semaphore != nil { if s.server.semaphore != nil {
destructEmptySemaphores(s) destructEmptySemaphores(s)
s.server.semaphoreLock.Lock() s.server.semaphoreLock.Lock()
for id, sema := range s.server.semaphore { for id, sema := range s.server.semaphore {
if sema.id == sem { if sema.id == pkt.SemaphoreID {
if strings.HasPrefix(id, "hs_l0u3B5") { if strings.HasPrefix(id, "hs_l0u3B5") {
releaseRaviSemaphore(s, sema) releaseRaviSemaphore(s, sema)
s.server.semaphoreLock.Unlock() s.server.semaphoreLock.Unlock()