diff --git a/Codigo/Modulo_UsUaRiOs.bas b/Codigo/Modulo_UsUaRiOs.bas index 9a5a332a..3f4919c9 100644 --- a/Codigo/Modulo_UsUaRiOs.bas +++ b/Codigo/Modulo_UsUaRiOs.bas @@ -68,7 +68,7 @@ End Function Public Function GetNextAvailableUserSlot() As Integer On Error GoTo ErrHandler If (AvailableUserSlot.currentIndex = 0) Then - GetNextAvailableUserSlot = 0 + GetNextAvailableUserSlot = -1 Return End If GetNextAvailableUserSlot = AvailableUserSlot.IndexInfo(AvailableUserSlot.currentIndex) diff --git a/Codigo/Protocol_GmCommands.bas b/Codigo/Protocol_GmCommands.bas index c9944017..658a5b4d 100644 --- a/Codigo/Protocol_GmCommands.bas +++ b/Codigo/Protocol_GmCommands.bas @@ -4728,6 +4728,8 @@ On Error GoTo HandleDebugRequest_Err: ElseIf debugType = 1 Then ReDim Args(1) As String Args(0) = Reader.ReadString8() + ElseIf debugType = 2 Then + ReDim Args(0) As String Else Exit Sub End If diff --git a/Codigo/Protocol_Writes.bas b/Codigo/Protocol_Writes.bas index c84e5579..d513bbd0 100644 --- a/Codigo/Protocol_Writes.bas +++ b/Codigo/Protocol_Writes.bas @@ -5778,6 +5778,9 @@ Public Sub WriteDebugLogResponse(ByVal UserIndex As Integer, ByVal debugType, By timeSinceLastReset = GetTickCount() - .Counters.TimeLastReset Call Writer.WriteString8("validConnection: " & .ConnIDValida & " connectionID: " & .ConnID & " UserIndex: " & tIndex & " charNmae" & .name & " UserLogged state: " & .flags.UserLogged & ", time since last message: " & timeSinceLastReset & " timeout setting: " & DisconnectTimeout) End With + ElseIf debugType = 2 Then + Call Writer.WriteInt16(1) + Call Writer.WriteString8("remote DEBUG: avialable user slots: " & GetAvailableUserSlot) Else Call Writer.WriteInt16(1) Call Writer.WriteString8("DEBUG: failed to find user: " & args(0)) diff --git a/Codigo/frmMain.frm b/Codigo/frmMain.frm index c1a152f7..0ec57598 100644 --- a/Codigo/frmMain.frm +++ b/Codigo/frmMain.frm @@ -826,7 +826,7 @@ Private Sub t_Extraer_Timer() Call Trabajar(i, UserList(i).Trabajo.TargetSkill) End If Next i - Call PerformTimeLimitCheck(PerformanceTimer, "Segundo_Timer", 100) + Call PerformTimeLimitCheck(PerformanceTimer, "t_Extraer_Timer", 100) End Sub Private Sub T_UsersOnline_Timer() diff --git a/Codigo/modNetwork.bas b/Codigo/modNetwork.bas index 9c7304dc..2d986a7d 100644 --- a/Codigo/modNetwork.bas +++ b/Codigo/modNetwork.bas @@ -92,9 +92,14 @@ On Error GoTo Kick_ErrHandler: Call AddLogToCircularBuffer("Kick connection: " & Connection) End If End If + Dim UserRef As t_UserReference + UserRef = Mapping(Connection) + If IsValidUserRef(UserRef) Then + If Not UserList(UserRef.ArrayIndex).flags.UserLogged Then + Call ReleaseUser(UserRef.ArrayIndex) + End If + End If If (message <> vbNullString) Then - Dim UserRef As t_UserReference - UserRef = Mapping(Connection) If UserRef.ArrayIndex > 0 Then Call Protocol_Writes.WriteErrorMsg(UserRef.ArrayIndex, Message) If UserList(UserRef.ArrayIndex).flags.UserLogged Then @@ -149,6 +154,9 @@ On Error GoTo OnServerConnect_Err: If Connection <= MaxUsers Then Dim FreeUser As Long FreeUser = NextOpenUser() + If FreeUser < 0 Then + Call Kick(Connection, "El server se encuentra lleno en este momento. Disculpe las molestias ocasionadas.") + End If If UserList(FreeUser).InUse Then Call LogError("Trying to use an user slot marked as in use! slot: " & FreeUser) FreeUser = NextOpenUser()