tornadoweb / tornadoweb/tornado

Try to skip getaddrinfo if "host" is already an IP

Open
#3,113 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

netutil
Dominant language
Python
Stars
22.2k
Forks
5.6k
Avg merge
3h 42m
Merged PRs (30d)
16

Description

TCPClient always calls resolver.resolve( even if "host" is already an IP

https://github.com/tornadoweb/tornado/blob/00c9e0ae31a5a0d12e09109fb77ffe391bfe1131/tornado/tcpclient.py#L260-L265

asyncio has a nice implementation that skips the getaddrinfo call https://github.com/python/cpython/blob/b5527688aae11d0b5af58176267a9943576e71e5/Lib/asyncio/base_events.py#L1369-L1380 in this case

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in tornado/tcpclient.py at the referenced resolver.resolve call, then compare the IP-address handling in asyncio/base_events.py. Confirm how TCPClient handles hosts that are already IP addresses and preserve normal resolution for other hosts; done means the resolver is skipped only for IP hosts.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.