> Hi Group,
> I''d like to be able to set a pacing behavior on outbound
messages, in
> this case one call of send_data is a message.
> Two scenarios come to mind.
> a) send_data with some fixed time interval between calls, send_data
> data is queued if more calls are made than can be
''allowed''/processed
Yeah I''d say just keep a queue of things to send and then have a timer
that every so often checks if it wants to send more. You could even
set it up to fire exactly when you anticipate being able to send more.
Timers aren''t totally accurate, it seems, but they do their best :)
> b) send_data freely until some max_count during an interval is
> reached, then queue messages until the end of the interval and resume
> sending the queued messages.
See above.
> - From what I''ve seen neither of these behavior are configurable
> (already implemented) in EM - correct?
Yep.
>
> Could anyone indicate what methods I might look at to implement these,
> that will at least give me a starting point to work from.
> Is there an existing project/example that implements a) or b) which I
> should look at?
Within the code there is something_streamer, which somewhat queues data.
> All,
>
> I''m working on my first EM application, and I''m stuck.
My client calls
> the server, which executes a long-running operation. I would like the
> server to be able to send data back to the client as the job executes,
> but right now all the data send to send_data is buffered up and sent
> when the job is complete. I''ve Googled for solutions and have
seen an
> answer using EM.next_tick, but this did not work for me. Also, I
> noticed in the document SPAWNED_PROCESSES it mentioned that spawned
> processes can be used to solve this problem, but I have not yet found
> an example. Here is a simplified version of my code
Run it in a different thread than EM?
> How hard would it be to use the Ruby OpenSSL bindings from within
> Eventmachine? I''d like to expose the client cert received by the
server to
> Ruby using functions that are defined in ossl_x509cert.c which is part of
> Ruby''s OpenSSL bindings. (This is part of an effort to make
Swiftiply work
> with Puppet.)
>
> I have hacked ssl.cpp to the point where I have SSL_VERIFY_PEER working
(so
> the client is asked to send a cert and I can call X509_get_subject_name()
on
> the cert). Now I''d like to pass the *X509 cert handle to
something like
> ossl_x509_new(X509 *x509) which returns a Ruby VALUE, which in turn could
then
> be exposed through Eventmachine''s SslBox class (somehow).
>
> Any suggestions would be most welcome.
Yeah you''d have to hack into EM and make it accept your cert
parameters.
> Hello All,
>
> I''m having trouble detecting when a client terminates a tcp
connection to my
> server.
>
> If I define unbind, I see the following exception raised.
>
>
/usr/lib64/ruby/gems/1.8/gems/eventmachine-0.10.0/lib/eventmachine.rb:1071:in
`event_callback'':
> EventMachine::ConnectionNotBound (EventMachine::ConnectionNotBound)
> from
/usr/lib64/ruby/gems/1.8/gems/eventmachine-0.10.0/lib/eventmachine.rb:226:in
> `release_machine''
> from
/usr/lib64/ruby/gems/1.8/gems/eventmachine-0.10.0/lib/eventmachine.rb:226:in
`run''
> from ./order_daemon.rb:355:in `run''
> from ./order_daemon.rb:373
Put a wrapper around EM::Run which detects any raised errors [?]
> Also, when you add a periodic timer using the add_periodic_timer method,
there
> doesn''t seem to be a way to kill the timer. It will keep running
even if you
> return the value specified in the add_periodic_timer method (the examples
all
> show nil, this didn''t work).
If you use the Timer or PeriodicTimer class I believe you can cancel
it more easily. I''m not sure about return value.
> Dumb question #1 part 2: can you issue a EventMachine::start_server
command
> and have it grab the next available port similar to the way TCPServer
> behaves? Note, I''m not lazy just don''t know how to grab
the IP & Port. N00b
> remember
+1 for wishing this existed, instead of having to check and search for
available ports on shared hosts.