Opened 8 years ago

Closed 8 years ago

#252 closed task (fixed)

deprecate tub.listenOn("tcp:0")

Reported by: Brian Warner Owned by:
Priority: major Milestone: 0.12.0
Component: network Version: 0.9.1
Keywords: Cc:

Description (last modified by Brian Warner)

We're moving towards less auto-magic allocation/detection and more pre-allocated ports and user-supplied hostnames/IP-addresses. The practice of automatically detecting locally-attached interfaces only works when the other machine you're talking to is on the same network (and with NAT, this is usually not true). And the automatic detection makes things less predictable.

So the plan is to deprecate the following:

  • Listener.getPortnum()
  • tub.setLocationAutomatically()
  • tub.listenOn("tcp:0"). Or rather, you could still do that, but without .getPortnum() there's no way to find out the port that got allocated. So you should always choose the port number first.
  • #137 is WONTFIXed, which would have added Tub.listenOn(portfile=)
  • #138 is WONTFIXed, which would have added d=Tub.whenReady(), which should no longer be necessary when we stop waiting for ports to be allocated

And we're adding foolscap.util.allocate_tcp_port() (which doesn't block) to help applications perform the allocation ahead of time.

Change History (4)

comment:1 Changed 8 years ago by Brian Warner

Description: modified (diff)

comment:2 Changed 8 years ago by Brian Warner

I'm working on the code for this, and it requires some UI changes to the foolscap tools:

  • flappserver create now requires --location=.
  • flogtool create-gatherer and create-incident-gatherer both require new --location= arguments
  • Old flappserver directories (with an empty stored location and/or port) must be upgraded. We can allocate a port without user intervention, but if the location is not set, we need an error message to ask the user to choose a hostname and write it into BASEDIR/location.
  • Likewise for log-gatherers, although to be honest I think I'd just advise the user to blow away the gatherer and make a new one. I don't believe anyone outside of AllMyData ever used them.

The process is educational: I'm learning what sorts of changes will be required of Tahoe when this lands.

comment:3 Changed 8 years ago by Brian Warner

One note: Listener is becoming smaller right now (pieces of its API are being deprecated). But it might get bigger again in the future. I'm still interested in having a single TCP port accept both HTTP and Foolscap connections, and in a "redirect" Tub lookup, and I think both features will involve creating a standalone Listener, tweaking it somehow, then submitting it to Tub.listenOn(mylistener). The ability to do that was removed a while ago, but that doesn't mean it won't come back some day.

comment:4 Changed 8 years ago by Brian Warner

Milestone: eventually0.12.0
Resolution: fixed
Status: newclosed

Landed in [5946155].

Note: See TracTickets for help on using tickets.