Giter Site home page Giter Site logo

reuse-port option not work? about pipy HOT 4 CLOSED

yyk808 avatar yyk808 commented on August 24, 2024
reuse-port option not work?

from pipy.

Comments (4)

pajama-coder avatar pajama-coder commented on August 24, 2024

The option --reuse-port corresponds to SO_REUSE_PORT socket option, which is only meaningful for a listening socket. But I'll look to provide a way to change socket options before binding/connecting a client-side socket, if that could be helpful in your case.

from pipy.

pajama-coder avatar pajama-coder commented on August 24, 2024

@yyk808 In the latest commit cae1935 a new state 'open' is added to connect() filter's callback, where you can do setsockopt() right after a socket is open and before anything else, like:

var SOL_SOCKET = 1
var SO_REUSEPORT = 15

pipeline($=>$
  .connect('x.x.x.x:nnn', {
    onState: inb => {
      if (inb.state === 'open') {
        inb.socket.setRawOption(SOL_SOCKET, SO_REUSEPORT, new Data([1]))
      }
    }
  })
)

from pipy.

pajama-coder avatar pajama-coder commented on August 24, 2024

@yyk808 The last change for adding an 'open' state to an Outbound had a bug that caused a crash. The issue was just fixed in commit d36b333. You'll probably need an update as you use the onState callback.

from pipy.

yyk808 avatar yyk808 commented on August 24, 2024

@yyk808 The last change for adding an 'open' state to an Outbound had a bug that caused a crash. The issue was just fixed in commit d36b333. You'll probably need an update as you use the onState callback.

Thank you very much! This helps a lot.

from pipy.

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.