Giter Site home page Giter Site logo

Comments (6)

heftig avatar heftig commented on June 28, 2024

Interestingly, if you pass instead of raise, it works fine.

I wonder what's going on. The code paths seem to be the same since neither __aexit__ is actually interested in the exception.

from aioftp.

pohmelie avatar pohmelie commented on June 28, 2024

@heftig, probably something differs at flushing quit, so on raise there is no real data transfer.

add the write_eof to DataConnectionThrottleStreamIO.__aexit__

This definitely should be there, thanks! 👍

from aioftp.

heftig avatar heftig commented on June 28, 2024

The code paths seem to be the same since neither aexit is actually interested in the exception.

Strike that; DataConnectionThrottleStreamIO.__aexit__ doesn't call finish if there's an exception. As a result, close doesn't get called either, and the connection stays open.

So write_eof was a red herring, and it was really the missing close.

I guess since every write on the stream does a drain, write_eof isn't needed?

from aioftp.

heftig avatar heftig commented on June 28, 2024

AFAIK normally to close a connection you write_eof, then await drain and then close, to ensure all bytes have been sent.

from aioftp.

pohmelie avatar pohmelie commented on June 28, 2024

It looks like writer.close() is enough here. Since write_eof closing only writing, but you can still read (as documentation said). Also, not all transports support write_eof.
Is it enough?

async def __aexit__(self, exc_type, exc, tb):

    if exc is None:

        await self.finish()

    else:

        self.close()

from aioftp.

heftig avatar heftig commented on June 28, 2024

Yes, that works too, thanks.

from aioftp.

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.