Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Add read-ahead logic. #76

Merged
merged 6 commits into from
Sep 20, 2014
Merged

Add read-ahead logic. #76

merged 6 commits into from
Sep 20, 2014

Conversation

Lukasa
Copy link
Member

@Lukasa Lukasa commented Sep 19, 2014

This is my proposed synchronous solution to #65. It involves optimistically reading up to 9 extra frames from the connection each time we read a single frame.

The logic continues to implement a 'block until at least one frame is read' behaviour. That's important, we rely on that blocking IO (though arguably we shouldn't). We then read up to 9 more frames without blocking.

This is not quite complete, I need to do a bit more of a refactor to finish this off.

@Lukasa
Copy link
Member Author

Lukasa commented Sep 19, 2014

I also suspect this build will fail.

Lukasa added a commit that referenced this pull request Sep 20, 2014
@Lukasa Lukasa merged commit 070dd9b into development Sep 20, 2014
@Lukasa Lukasa deleted the readahead branch September 20, 2014 10:30
if self._bytes_in_buffer:
return True

read = select.select([self._sck], [], [], 0)[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work on Windows according to the docs. You might want to document that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not? We're using sockets here, so it should be fine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore me. I need more ☕

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants