2011/8/9 Guillaume (Numerizik) <[email protected]>:
> Yes ! i'll do this !
>
> Can you give me sample for auth, on_connect and on_disconnect ? I don't
> really understand good syntax.

This works:

max_listeners = 2
listeners = ref 0

def auth(_,_) =
  if !listeners < max_listeners then
    listeners := !listeners + 1
    log("One more listener! Total count: #{!listeners}")
    true
  else
    log("Maximun number of listeners reached..")
    false
  end
end

def on_disconnect(_) =
  log("On less listener..")
  listeners := !listeners - 1
end

output.harbor(%mp3,
              mount="foo",
              auth=auth,
              on_disconnect=on_disconnect,
              sine())

However, while testing it I realized that this kind of use was not
initally intended...
First, you need to pass a fake authentication data:
  http://fake_user:fake_passord@host:8000/foo

Second, client that try to connect while maximun number of listeners
is reached will get a "wrong authentication" response, which may be
confusing..

I will see what I can do about these two..

Also, dont forget to test before puttin in production: this is a
relatively new feature and quite a big chunk of code..

Romain

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to