From 476db5308088f0a907aa72726a75e31c695a92d3 Mon Sep 17 00:00:00 2001
From: Anders Svensson
Date: Thu, 11 Oct 2012 15:44:24 +0200
Subject: Add start/stop service_event()
---
lib/diameter/doc/src/diameter.xml | 11 +++++++++++
lib/diameter/src/base/diameter_service.erl | 2 ++
2 files changed, 13 insertions(+)
(limited to 'lib')
diff --git a/lib/diameter/doc/src/diameter.xml b/lib/diameter/doc/src/diameter.xml
index 80863f8eff..a35fd5b3a8 100644
--- a/lib/diameter/doc/src/diameter.xml
+++ b/lib/diameter/doc/src/diameter.xml
@@ -512,6 +512,17 @@ following types.
+start
+stop
+
+-
+
+The service is being started or stopped.
+No event precedes a start event.
+No event follows a stop event and this event
+implies the termination of all transport processes.
+
+
{up, Ref, Peer, Config, Pkt}
{up, Ref, Peer, Config}
{down, Ref, Peer, Config}
diff --git a/lib/diameter/src/base/diameter_service.erl b/lib/diameter/src/base/diameter_service.erl
index cffba4fc94..36907a8d1c 100644
--- a/lib/diameter/src/base/diameter_service.erl
+++ b/lib/diameter/src/base/diameter_service.erl
@@ -681,6 +681,7 @@ upgrade_insert(#state{service = #diameter_service{pid = Pid}} = S) ->
%%% ---------------------------------------------------------------------------
terminate(Reason, #state{service_name = Name} = S) ->
+ send_event(Name, stop),
ets:delete(?STATE_TABLE, Name),
shutdown == Reason %% application shutdown
andalso shutdown(S).
@@ -857,6 +858,7 @@ i(SvcName) ->
lists:foreach(fun(T) -> start_fsm(T,S) end, CL),
init_shared(S),
+ send_event(SvcName, start),
S.
cfg_acc({SvcName, #diameter_service{applications = Apps} = Rec, Opts},
--
cgit v1.2.3