Added a way to call a callback on launched and stopped for Nino connector

This commit is contained in:
Jocelyn Fiat
2013-02-27 21:49:42 +01:00
parent 92d3f642ac
commit 22a725b8be
2 changed files with 47 additions and 9 deletions

View File

@@ -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