Opened 8 years ago

Last modified 8 years ago

#7133 enhancement new

Replace reactor.connectTCP with a lower-level API

Reported by: Itamar Turner-Trauring Owned by: PenguinOfDoom
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:
Author:

Description

Motivation:

  1. Mismatch between endpoint API and reactor API.
  2. Code duplication between regular and IOCP code.
  3. DNS resolution in wrong place; it should be policy at a higher level.
  4. Connectors are crappy and have bad edge cases.

Proposal: reactor.connectToIP(ip, port, 0-arg-callable-that-returns-Protocol-instance) should return Deferred that fires with Protocol instance on connection, errbacks on failure to connect, and is cancellable. (A better name for the method is needed, I think).

reactor.connectTCP can now implement hostname resolution, timeouts, connectors as wrapper around low-level API.

Follow up tickets can switch endpoints to talk directly to new API.

Change History (2)

comment:1 Changed 8 years ago by Itamar Turner-Trauring

The proposed initial API is problematic in terms of disconnect detection; it would require a Protocol wrapper, which is meh. Disconnection notification is similarly problematic for endpoint based reconnection API. So either:

  1. Add extra argument to connectToIP, a callable that is called on disconnection with protocol and reason.
  2. Add notifyOnDisconnct or some such to transports.

comment:2 Changed 8 years ago by Jean-Paul Calderone

How about connectToBlah(address) which returns a Deferred that fires with a tube that you can hook up to a protocol if you feel like it?

Note: See TracTickets for help on using tickets.