[muscle] SV: SV: SV: Re: SV: Re: Server Design issue.
- From: "David Svanberg" <ds@xxxxxxxxxxx>
- To: <muscle@xxxxxxxxxxxxx>
- Date: Mon, 27 Oct 2003 12:48:36 +0100
Actually the EndServer( ) call doesn't work so nice that I'd thought.
What I do is that I call the following in my MessageReceivedFromGateway in
my derivied StorageReflectSession class (a "server-stopper-client" sends the
NB_COMMAND_STOP_SERVER message to the server):
switch ( msg->what )
{
case NB_COMMAND_STOP_SERVER:
{
Cleanup( );
EndServer( );
break;
}
...
If I'm not calling Cleanup( ) MUSCLE will be very angry and say that I
probably hasn't called Cleanup( ). This will result in a lot of LogTime's
and a segmentation fault. So I added Cleanup( ) ...but...
On RH9 (linux,g++,pthreads) the application exits with the "Killed" message
to the std output. It is strange - it is just if I had issued "kill -9 pid"!
On Windows (msvc,win32) the application crashes with "Unhandled
exception..." at line 1007 in storagereflectsession.cpp.
What am I missing in order to stop the server correctly?
/D
-----Opprinnelig melding-----
Fra: muscle-bounce@xxxxxxxxxxxxx [mailto:muscle-bounce@xxxxxxxxxxxxx]På;
vegne av David Svanberg
Sendt: 27. oktober 2003 10:11
Til: muscle@xxxxxxxxxxxxx
Emne: [muscle] SV: SV: Re: SV: Re: Server Design issue.
Sorry,
next time I should consult the docs first. EndServer seems to be a pretty
nice little method to achieve want I want...
...sorry...
/D
-----Opprinnelig melding-----
Fra: muscle-bounce@xxxxxxxxxxxxx [mailto:muscle-bounce@xxxxxxxxxxxxx]På;
vegne av David Svanberg
Sendt: 27. oktober 2003 10:06
Til: muscle@xxxxxxxxxxxxx
Emne: [muscle] SV: Re: SV: Re: Server Design issue.
Hi,
is there a way to stop the server from a StorageReflectSession object?
I have a client sending a NB_COMMAND_STOP_SERVER message and wants actually
to stop the server when the server gets this message... :)
/D
-----Opprinnelig melding-----
Fra: muscle-bounce@xxxxxxxxxxxxx [mailto:muscle-bounce@xxxxxxxxxxxxx]På;
vegne av Jeremy Friesner
Sendt: 22. oktober 2003 17:54
Til: muscle@xxxxxxxxxxxxx
Emne: [muscle] Re: SV: Re: Server Design issue.
> It should be good if one could do a ServerProcessSingleLoop that runs one
> iteration through the ServerProcessLoop leaving control back to the
caller.
That wouldn't work very well, because each iteration through the loop
contains a call to select(), and select() may block for a long period of
time
(it willl block until the next piece of I/O is ready for processing, or
until
the next PulseNode event-time has arrived).
> Having the possibility to install a callback function from the
> ServerProcessLoop giving us the chance to interact.
You can get lots of callback hooks by installing a Session object and
overriding some of its methods to do what you want. (The session
object doesn't have to be connected to a client... you can pass in
socket=3D-1 to indicate there is no connection)
Jeremy
- Follow-Ups:
- [muscle] Re: SV: SV: SV: Re: SV: Re: Server Design issue.
- From: Jeremy Friesner
- References:
- [muscle] SV: SV: Re: SV: Re: Server Design issue.
- From: David Svanberg
Other related posts:
- » [muscle] SV: SV: SV: Re: SV: Re: Server Design issue.
- » [muscle] Re: SV: SV: SV: Re: SV: Re: Server Design issue.
- [muscle] Re: SV: SV: SV: Re: SV: Re: Server Design issue.
- From: Jeremy Friesner
- [muscle] SV: SV: Re: SV: Re: Server Design issue.
- From: David Svanberg