Skip to content

Add EventMachine.attach_server#465

Merged
tmm1 merged 2 commits intoeventmachine:masterfrom
benburkert:attach_server
Sep 26, 2013
Merged

Add EventMachine.attach_server#465
tmm1 merged 2 commits intoeventmachine:masterfrom
benburkert:attach_server

Conversation

@benburkert
Copy link
Copy Markdown
Contributor

This adds the EventMachine.attach_server & EventMachine.attach_socket_server methods for registering an existing FD/socket created outside of EventMachine. It's a simplified version of #271, but without the CLOEXEC/autoclose stuff. This allows sockets to be shared between parent & child processes like with unicorn's fork-then-exec graceful restart functionality.

@tmm1
Copy link
Copy Markdown
Contributor

tmm1 commented Sep 25, 2013

cc @brianmario

… socket.

Otherwise the FD could be closed by a GC.
@benburkert
Copy link
Copy Markdown
Contributor Author

I've simplified this to one method that accepts a socket or FD. It also holds onto a reference to the socket so that the FD is not closed when the socket object is GC'd.

tmm1 added a commit that referenced this pull request Sep 26, 2013
Add EventMachine.attach_server & EventMachine.attach_socket_server
@tmm1 tmm1 merged commit 89a34c7 into eventmachine:master Sep 26, 2013
@benburkert benburkert deleted the attach_server branch September 26, 2013 00:40
@brianmario
Copy link
Copy Markdown

omg I love you so much

On Sep 25, 2013, at 19:50, Aman Gupta [email protected] wrote:

cc @brianmario


Reply to this email directly or view it on GitHub.

@brianmario
Copy link
Copy Markdown

any chance we can get the method added that returns the FD num for Connection objects and accept signatures? ;)

On Sep 25, 2013, at 19:50, Aman Gupta [email protected] wrote:

cc @brianmario


Reply to this email directly or view it on GitHub.

@benburkert
Copy link
Copy Markdown
Contributor Author

@brianmario are you talking about this signature? https://github.com/macournoyer/thin/blob/master/lib/thin/backends/unix_server.rb#L22

I've been reusing this hack, but I think it makes sense for this method to return the signature.

@brianmario
Copy link
Copy Markdown

right yeah. the issue is that the signature is used all over the rest of the EM API to track these, not the FD number.

I need a way to get the FD for a signature

On Sep 25, 2013, at 20:54, Ben Burkert [email protected] wrote:

@brianmario are you talking about this signature? https://github.com/macournoyer/thin/blob/master/lib/thin/backends/unix_server.rb#L22

I've been reusing this hack, but I think it makes sense for this method to return the signature.


Reply to this email directly or view it on GitHub.

@sodabrew
Copy link
Copy Markdown
Member

sodabrew commented Jan 4, 2015

Was this ever implemented for JRuby? https://github.com/eventmachine/eventmachine/pull/271/files#r22436804

If not, the test should be skipped on JRuby #551.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants