Structuring an application

Rick Pettit rpettit@REDACTED
Fri Jan 13 16:57:41 CET 2006


On Fri, Jan 13, 2006 at 03:38:52PM +0000, Joel Reymont wrote:
> Folks,
> 
> I have an app that launches hundreds of poker bots against a poker  
> server.
> 
> Each bot needs to have a different user name and password. These can  
> be obtained by asking a "name server".
> 
> Each bot launches two socket readers, processes that loop reading  
> packets in passive mode. The reason I do it this way is because  
> packet length is given to me in little-endian order and is the length  
> of the whole packet including the length itself.
> 
> I would like to fail the poker bot when either of the two socket  
> readers fail. I would also like to monitor the poker bot to update  
> the failed counter when the bot fails. When all bots fail or exit  
> cleanly then the supervisor should exit.
> 
> How can I achieve this with standard OTP tools? I thought I could use  
> a supervisor but there's no restart policy to let a child fail while  
> others continue.

I believe you are wrong here. From supervisor(3):


       A supervisor can have one of the following restart strate-
       gies:

         * one_for_one  -  if  one  child  process terminates and
           should  be  restarted,  only  that  child  process  is
           affected.

Just out of curiousity, are you taking a crash course in Erlang for work,
school, or fun? You ask a ton of questions :-)

I don't mean to poke fun, just curious.

-Rick



More information about the erlang-questions mailing list