Skip to content

Commit

Permalink
extra checking to prevent users from logging onto mode than 1 node at…
Browse files Browse the repository at this point in the history
… the same time
  • Loading branch information
dmcoles committed Nov 27, 2023
1 parent b8c658b commit f860c8d
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions express.e
Original file line number Diff line number Diff line change
Expand Up @@ -2960,19 +2960,30 @@ PROC checkUserOnLine(check)
IF(check)
loop:=0
error:=1

IF sopt.toggles[TOGGLES_MULTICOM]
ObtainSemaphore(masterNode)
ENDIF

REPEAT
IF(loop=node) THEN loop++

IF sopt.toggles[TOGGLES_MULTICOM]
status:=-1
ObtainSemaphore(masterNode)
sp:=(masterNode.myNode[loop].s)
ReleaseSemaphore(masterNode)

IF sp
ObtainSemaphore(sp)
status:=sp.status
ReleaseSemaphore(sp)
lock:=-1
IF (status>=0) AND (status<>ENV_NOTACTIVE) AND (status<>ENV_SHUTDOWN)
IF(stringCompare(sp.handle,loggedOnUser.name)=RESULT_SUCCESS)
lock:=0
error:=0
ENDIF
ENDIF
status:=-1
ENDIF
ELSE
status:=0
Expand All @@ -2996,6 +3007,10 @@ PROC checkUserOnLine(check)
ENDIF
loop++
UNTIL (lock=NIL) OR (loop=MAX_NODES)

IF sopt.toggles[TOGGLES_MULTICOM]
ReleaseSemaphore(masterNode)
ENDIF
ELSE
error:=1
ENDIF
Expand Down

0 comments on commit f860c8d

Please sign in to comment.