2012/3/26 udo noll <[email protected]>:
> hello,

Hi,

> maybe someone can enlighten me:
>
> #my request source
> push = request.queue(id="agent")
>
> # add a flush, i.e stop command
> def add_flush(s) =
>        def flush(_) =
>                ret = server.execute("#{source.id(s)}.queue")
>                ret = list.hd(ret)
>                ret = string.split(separator=" ", ret)
>                if list.length(ret) > 0 then
>                        list.iter(fun(x) -> begin 
> ignore(server.execute("#{source.id(s)}.ignore #{x}")) end, ret)
>                        source.skip(s)
>                end
>                "done."
>        end
>
>        server.register(namespace="#{source.id(s)}",
>                description="flush queue",
>                usage="flush",
>                "flush",
>                flush)
> end
> add_flush(push)
>
> i'd expet that this adds a command "agent.flush" to my list of server 
> commands.
> but it adds something like src_1234.flush
> is #{source.id(s) not the id "agent" i've specified in request.queue?
> if i replace #{source.id(s)} with the id string, all is fine. but i wanted to
> reuse the function for other request.queue too...
> what's wrong? thanks for any tips,

I think your problem is that the fact that final source IDs are
attributed at run-time. It is very possible that at the time you
register your server command, the source has a temporary ID that is
changed when streaming starts. I would recommend trying something on
these lines:


# add a flush, i.e stop command
def add_flush(id) =
    #my request source
    push = request.queue(id=id)

       def flush(_) =
               ret = server.execute("#{source.id(s)}.queue")
               ret = list.hd(ret)
               ret = string.split(separator=" ", ret)
               if list.length(ret) > 0 then
                       list.iter(fun(x) -> begin
ignore(server.execute("#{source.id(s)}.ignore #{x}")) end, ret)
                       source.skip(s)
               end
               "done."
       end

       server.register(namespace="#{source.id(s)}",
               description="flush queue",
               usage="flush",
               "flush",
               flush)
end

push = add_flush("agent")

Hope this makes sense..

Romain

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to