Giter Club home page Giter Club logo

Comments (8)

wallyqs avatar wallyqs commented on May 28, 2024 1

Published new release of the gem with your fixes so closing this one for now, thanks!
https://github.com/nats-io/pure-ruby-nats/releases/tag/v0.1.2

from nats-pure.rb.

ripienaar avatar ripienaar commented on May 28, 2024

After some more digging into this I think the problem is much simpler luckily

So simply changing that to:

        addrinfo.each_with_index do |ai, i|
          begin
            @socket = connect_addrinfo(ai, @uri.port, @connect_timeout)
            break
          rescue SystemCallError
            # Give up if no more available
            raise if addrinfo.length == i+1
          end
        end

ie. breaking if the socket connect_addrinfo doesn't raise any errors - ie. we're connected - then this all works

Some extra error callbacks would still be good

from nats-pure.rb.

ripienaar avatar ripienaar commented on May 28, 2024

PR addresses the stuff I mentioned - except for the V6 first.

@wallyqs you're free to discard and do whatever you prefer, there doesnt seem to be test coverage for the Socket class so I didnt add any tests

from nats-pure.rb.

wallyqs avatar wallyqs commented on May 28, 2024

Good catch... Merged your changes after adding some minor changes to the spec. I will take a look at the ipv4/ipv6 connection preference and update here too. Thanks for the PR and the feedback!

from nats-pure.rb.

wallyqs avatar wallyqs commented on May 28, 2024

Seems that since right now we are relying on the default behavior from Socket.getaddrinfo for the ordering of the list of endpoints to attempt to connect, and since it looks like that result already went through from what is defined in the RFC-3484 and RFC-6724 standards, think we can probably leave as is for now, and letting the user determine the ipv6 ordering by tuning /etc/gai.conf to set the precedence of address families to try when connecting as it is suggested in those RFCs.

from nats-pure.rb.

ripienaar avatar ripienaar commented on May 28, 2024

That's what I thought but my machines are configured for IPv6 priority already - and works for other stuff. Not to worry I will investigate further and if I can narrow it down to either environment or code I will make a new ticket. For now happy to close this one

from nats-pure.rb.

wallyqs avatar wallyqs commented on May 28, 2024

As a separate issue sounds good for now, we could add a sort_by ipv6 before attempting to connect ( (wallyqs/pure-ruby-nats@48dfda9d5967fc17832e565817e3ee64ff368937)[example]) so that those addresses are tried first but just not sure whether that is correct. Thanks again.

from nats-pure.rb.

ripienaar avatar ripienaar commented on May 28, 2024

Yeah, I'll investigate more - probably in a few weeks.

Happy to close this and hopefully we get a release soon :)

from nats-pure.rb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.