perplexes / m2r

Mongrel2 Connection Adapter - Ruby Encrusted Steel-Reinforced Fist
MIT License
90 stars 11 forks source link

Allow to reuse/set ZMQ context used by Mongrel2 #5

Closed paneq closed 12 years ago

paneq commented 12 years ago

As stated in: http://zguide.zeromq.org/page:all#Getting-the-Context-Right : "You should create and use exactly one context in your process"

Sometimes the programmer might want to create the Context itself and let the handler use it. It can be done in two ways:

a) setting Mongrel2.zmq_context b) providing it as a dependency when creating new Connection:

Mongrel2::Connection.new(sender_id, pull_addr, pub_addr, context)

But most people do not have such needs so by default we create our own context with 1 thread for IO.

paneq commented 12 years ago

I also try to establish in this commit a basic culture of testing :) What do you think @perplexes , @pawelpacana ?

mostlyobvious commented 12 years ago

I totally support this since it:

mostlyobvious commented 12 years ago

@paneq Can you please rebase on master?

paneq commented 12 years ago

yep.

paneq commented 12 years ago

Closing in favor of #12