forked from shaba/openuds
Merge remote-tracking branch 'origin/v3.5'
This commit is contained in:
commit
0f587a4ec1
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright (c) 2012-2021 Virtual Cable S.L.U.
|
# Copyright (c) 2012-2022 Virtual Cable S.L.U.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without modification,
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
@ -233,6 +233,7 @@ class IPMachinesService(IPServiceBase):
|
|||||||
def canBeUsed(self, locked: typing.Optional[int], now: int) -> int:
|
def canBeUsed(self, locked: typing.Optional[int], now: int) -> int:
|
||||||
# If _maxSessionForMachine is 0, it can be used only if not locked
|
# If _maxSessionForMachine is 0, it can be used only if not locked
|
||||||
# (that is locked is None)
|
# (that is locked is None)
|
||||||
|
locked = locked or 0
|
||||||
if self._maxSessionForMachine <= 0:
|
if self._maxSessionForMachine <= 0:
|
||||||
return not bool(locked) # If locked is None, it can be used
|
return not bool(locked) # If locked is None, it can be used
|
||||||
|
|
||||||
@ -345,7 +346,7 @@ class IPMachinesService(IPServiceBase):
|
|||||||
now = getSqlDatetimeAsUnix()
|
now = getSqlDatetimeAsUnix()
|
||||||
locked = self.storage.getPickle(theIP)
|
locked = self.storage.getPickle(theIP)
|
||||||
if self.canBeUsed(locked, now):
|
if self.canBeUsed(locked, now):
|
||||||
self.storage.putPickle(id, now) # Lock it
|
self.storage.putPickle(theIP, now) # Lock it
|
||||||
|
|
||||||
def processLogout(self, id: str) -> None:
|
def processLogout(self, id: str) -> None:
|
||||||
'''
|
'''
|
||||||
|
Loading…
Reference in New Issue
Block a user