<> <> <> <> DIRECTORY Basics, BasicTime, Commander, ComputeServerClient, ComputeServer, ComputeServerControl, ComputeServerDebugger, ComputeServerInternal, InterpreterToolPrivate, IO, PrincOps, PupDefs, PupErrors, PupTypes; ComputeServerActiveServicesImpl: CEDAR MONITOR IMPORTS BasicTime, ComputeServerInternal, PupErrors EXPORTS ComputeServerInternal = BEGIN <> STREAM: TYPE = IO.STREAM; ActiveServicesItem: TYPE = ComputeServerInternal.ActiveServicesItem; ActiveServicesListBase: PUBLIC ComputeServerInternal.ActiveServicesItem _ NIL; ActiveServicesItemObject: TYPE = ComputeServerInternal.ActiveServicesItemObject; PupListener: TYPE = REF ComputeServerInternal.PupListenerObject; <> AddPupAddress: PUBLIC ENTRY PROC [serverPupAddress: PupDefs.PupAddress, procHandle: ComputeServerInternal.RegisteredProcHandle, listener: PupListener] RETURNS [newItem: ActiveServicesItem] = { newItem _ NEW[ActiveServicesItemObject _ [next: ActiveServicesListBase, listenerPupAddress: serverPupAddress, listener: listener, startListenGMT: BasicTime.Now[], procHandle: procHandle, success: true]]; ActiveServicesListBase _ newItem; }; MatchPupAddress: PUBLIC ENTRY PROC [serverPupAddress: PupDefs.PupAddress, flagStarted: BOOL] RETURNS [found: BOOL, item: ActiveServicesItem] = { nowItem: ActiveServicesItem _ ActiveServicesListBase ; WHILE nowItem # NIL DO IF serverPupAddress = nowItem.listenerPupAddress THEN { IF flagStarted THEN nowItem.heardDoService _ TRUE; RETURN [TRUE, nowItem]; }; nowItem _ nowItem.next; ENDLOOP; RETURN[FALSE, NIL]; }; findDebuggerItemFromInterpreterHandle: PUBLIC ENTRY PROC [h: InterpreterToolPrivate.Handle] RETURNS [found: BOOL, item: ActiveServicesItem _ NIL] = { nowItem: ActiveServicesItem _ ActiveServicesListBase ; WHILE nowItem # NIL DO IF h = nowItem.h THEN RETURN [TRUE, nowItem]; nowItem _ nowItem.next; ENDLOOP; RETURN[FALSE, NIL]; }; KillOldUnstartedServices: PUBLIC PROC = { nowItem: ActiveServicesItem _ ActiveServicesListBase ; lastItem: ActiveServicesItem _ NIL; now: BasicTime.GMT _ BasicTime.Now[]; WHILE nowItem # NIL DO IF ~nowItem.heardDoService AND BasicTime.Period[nowItem.startListenGMT, now] > 77 THEN { IF nowItem.listener # NIL THEN ComputeServerInternal.DestroyPupListener[nowItem.listener]; nowItem.listener _ NIL; IF lastItem = NIL THEN ActiveServicesListBase _ nowItem.next ELSE lastItem.next _ nowItem.next; }; lastItem _ nowItem; nowItem _ nowItem.next; ENDLOOP; }; DeletePupAddress: PUBLIC ENTRY PROC [serverPupAddress: PupDefs.PupAddress] RETURNS [found: BOOL] = { nowItem: ActiveServicesItem _ ActiveServicesListBase ; lastItem: ActiveServicesItem _ NIL; WHILE nowItem # NIL DO IF serverPupAddress = nowItem.listenerPupAddress THEN { IF nowItem.listener # NIL THEN ComputeServerInternal.DestroyPupListener[nowItem.listener]; nowItem.listener _ NIL; IF lastItem = NIL THEN ActiveServicesListBase _ nowItem.next ELSE lastItem.next _ nowItem.next; RETURN[TRUE]; }; lastItem _ nowItem; nowItem _ nowItem.next; ENDLOOP; RETURN[FALSE]; }; <> END. <> <> <<>>