Added a way to call a callback on launched and stopped for Nino connector
This commit is contained in:
@@ -23,6 +23,10 @@ feature {NONE} -- Initialization
|
||||
|
||||
create cfg.make
|
||||
create server.make (cfg)
|
||||
|
||||
-- Callbacks
|
||||
create on_launched_actions
|
||||
create on_stopped_actions
|
||||
end
|
||||
|
||||
make_with_base (a_service: like service; a_base: like base)
|
||||
@@ -69,6 +73,14 @@ feature -- Status report
|
||||
-- Listening port.
|
||||
--| 0: not launched
|
||||
|
||||
feature -- Callbacks
|
||||
|
||||
on_launched_actions: ACTION_SEQUENCE [TUPLE [WGI_CONNECTOR]]
|
||||
-- Actions triggered when launched
|
||||
|
||||
on_stopped_actions: ACTION_SEQUENCE [TUPLE [WGI_CONNECTOR]]
|
||||
-- Actions triggered when stopped
|
||||
|
||||
feature -- Element change
|
||||
|
||||
on_launched (a_port: INTEGER)
|
||||
@@ -76,11 +88,13 @@ feature -- Element change
|
||||
do
|
||||
launched := True
|
||||
port := a_port
|
||||
on_launched_actions.call ([Current])
|
||||
end
|
||||
|
||||
on_stopped
|
||||
-- Server stopped
|
||||
do
|
||||
on_stopped_actions.call ([Current])
|
||||
launched := False
|
||||
port := 0
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user