Wednesday, December 28, 2011

[Workaround] Dnsruby GEM not working on Heroku

The rationale is in this google group:

*blah* *blah* Errno::ECONNREFUSED *blah* *blah* on heroku trying to open listening socket on localhost

The solution: after you require 'dnsruby', add this line:

require 'dnsruby'
# Patch Dnsruby which is broken on Heroku:
module Dnsruby; class SelectThread;     def get_socket_pair; srv = nil; srv = TCPServer.new('::1', 0); rsock = TCPSocket.new(srv.addr[3], srv.addr[1]); lsock = srv.accept; srv.close; return [lsock, rsock]; end; end; end

You're welcome!

0 comments: