Hello,

this patch adds a new type of events to SEMS core: SystemEvents. They 
may be sent to all active sessions using the EventDispatcher's new 
broadcast() functions. Using this functionality we can signal something 
to all active sessions, e.g. that the server will be shut down. The 
default behaviour implemented in AmSession for this is to stop the 
session using setStopped(). This way, if you send a signal to SEMS, all 
active sessions are ended before SEMS is shut down, as implemented in 
the new onSystemEvent() event handler.

If you are using EventDispatcher with your own event queues, as e.g. the 
SIPRegistrarClient does, then you also need to handle at least the 
ServerShutdown event, if you don't want to block SEMS from stopping (it 
stops only when all EventQueues are removed from EventDispatcher).

In case you are wondering: Events now have got a clone() method and copy 
constructor, to clone the events before putting them in the event queues 
of many sessions - remember that the event queue owns the events once 
they are posted into it. If you want to use the 
AmEventDispatcher::broadcast() method with your own event type, don't 
forget to implement the clone() and the copy constructor.

BR
Stefan

o [EMAIL PROTECTED] [09/23/08 21:03]:
> Author: sayer
> Date: 2008-09-23 21:03:46 +0200 (Tue, 23 Sep 2008)
> New Revision: 1087
> 
> Modified:
[...]
> Log:
> first steps on proper shutdown:
>  -  active sessions and other event receivers 
>     get a SystemEvent::ServerShutdown, 
>     default behaviour of AmSession is setStopped()
>  -  session container waits for all sessions to be ended
>  -  signaling server, rtp receiver, media processor, event dispatcher
>     are stopped and deleted
> 
> based on a patch by Rui Jin Zheng rjzheng at boronetworks dot com
> 

-- 
Stefan Sayer
VoIP Services

[EMAIL PROTECTED]
www.iptego.com

IPTEGO GmbH
Am Borsigturm 40
13507 Berlin
Germany

Amtsgericht Charlottenburg, HRB 101010
Geschaeftsfuehrer: Alexander Hoffmann
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to