Add possibility to watch on outbound data #317

Open
wants to merge 5 commits into
from

Conversation

Projects
None yet
3 participants
Contributor

funny-falcon commented Apr 19, 2012

EM::Connection produced by EM.connect has no ability to react on slow clients, send_data pushes data infinitely.

This pull request two ability:

  1. to know outbound data size . It is already exists on C level, but were not exposed to Ruby level
  c = EM.connect('xx','xx', EM::Connection)
  c.send_data('a'*1000000)
  c.outbound_data_size
  1. to react on outbound data size reduction
  module Handler
    def sent_data
      puts "some data sent"
    end
  end
  c = EM.connect('xx','xx', EM::Connection){|c| c.notify_sent_data = true}
  c.send_data('a'*1000000)
Contributor

funny-falcon commented Apr 20, 2012

I found EM::Connection#get_outbound_data_size, so that I changes commits:
I add alias #outbound_data_size and add new method #outbound_data_count - I need for controlling message oriented stream (implementation of zmq).

Contributor

raggi commented Apr 21, 2012

Looks good, but, tests please!

Contributor

raggi commented Apr 21, 2012

(You may want assert_in_delta or the like)

Contributor

funny-falcon commented May 3, 2012

Sorry, still could not find a time to write tests. I'm using it locally, so that I can claim it works :)

Contributor

funny-falcon commented Sep 6, 2012

I've added the test.
By the way, fix setsockopt test - Travis marks all build as failed cause of it.

Contributor

funny-falcon commented Jan 8, 2015

I've added jruby implementation + added implementation for 'pause/resume/get_outbound_data_size'.
Removed first commit - 'get_outbound_data_count' - although i still think it is usefull.

Contributor

funny-falcon commented Jan 8, 2015

Looks like travis fails randomly on other tests. I can run test_sent_data.rb without issue.

sodabrew added this to the v1.2.0 milestone Feb 2, 2015

@sodabrew sodabrew modified the milestone: v1.2.0, v1.2.1 Feb 25, 2016

@sodabrew sodabrew modified the milestone: v1.2.1, v1.3.0 Nov 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment