3 DistFramework(session
:Session
)
8 PP2P
={LM
getLayer('dist
-layer
:pp2p' $
)}
9 BEP2P
={LM
getLayer('dist
-layer
:bep2p' $
)}
10 Alarm
={LM
getLayer('dist
-layer
:alarm' $
)}
11 UUID
='
epfd(8525f024
-6543-4108-abb8
-2621617504a9
)'
26 meth init(SId Handler
)
28 sendAlarm
:={Alarm
init(UUID|sendAlarm|SId
29 {self facet(alarm
:Send $
)})}
30 checkAlarm
:={Alarm
init(UUID|checkAlarm|SId
31 {self facet(alarm
:Check $
)})}
32 pp2p
:={PP2P
init(UUID|pp2p|SId
{self facet(pp2pDeliver
:Deliver $
)})}
33 bep2p
:={BEP2P
init(UUID|bep2p|SId
{self facet(bep2pDeliver
:Deliver $
)})}
34 oldMonitored
:={NewDictionary
}
35 monitored
:={NewDictionary
}
36 monitoring
:={NewDictionary
}
37 {@sendAlarm
setAlarmIn(SEND_DELAY
unit)}
38 {@checkAlarm
setAlarmIn(CHECK_DELAY
unit)}
41 @monitored
.(Remote
.id
):=false#Remote
42 @oldMonitored
.(Remote
.id
):=unit#Remote
43 {@pp2p
pp2pSend(Remote
monitor())}
45 meth Deliver(From Msg
)
48 @monitoring
.(From
.id
):=From
50 @monitored
.(From
.id
):=true#From
54 for X
in {Dictionary
.keys
@monitored
} do
55 if @oldMonitored
.X
.1 \
= @monitored
.X
.1 then
56 if @monitored
.X
.1 then
57 {@h
alive(@monitored
.X
.2)}
59 {@h
crash(@monitored
.X
.2)}
61 @oldMonitored
.X
:=@monitored
.X
63 @monitored
.X
:=false#(@monitored
.X
.2)
65 {@checkAlarm
setAlarmIn(CHECK_DELAY
unit)}
68 for X
in {Dictionary
.items
@monitoring
} do
69 {@bep2p
bep2pSend(X imAlive
)}
71 {@sendAlarm
setAlarmIn(SEND_DELAY
unit)}