tornadoweb / tornadoweb/tornado

iostream - cancel read_until_close

Open
#1,334 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hello,

I have a problem with switching a stream to TLS, it throws an exception saying that the stream is not idle. I guess it is because I have read_until_close called on it, so there is a read callback, but there is no actual data anywhere, so the stream could be switched to TLS.

Maybe the solution is to use another read method which reads only some amount of data, but the problem is that I don't have a clear condition on where to stop waiting for new data, the process can take time and it is governed by a state machine, regex would not work there, basically I am implementing an XMPP client lib on tornado.iostream

Any suggestions how to handle that? Is it possible to clear callbacks installed by read_until_close?

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 by reading the tornado.iostream implementation and the read_until_close behavior, then trace how a stream decides whether it is idle before switching to TLS. The issue would be resolved when the supported behavior for cancelling or replacing that pending read is defined and covered by appropriate tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.