forked from jonashaag/bjoern
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix an infinite loop caused by misuse of Unix API
Plus some refactoring. Closes jonashaag#88. The issue was that we checked for "read(...) <= 0", and then "errno not in {EAGAIN, EWOULDBLOCK}". Sometimes we would run into "read(...) == 0, errno in {EAGAIN, EWOULDBLOCK}". In this case we must NOT continue reading from the client, but rather close the connection. Indeed, it is illegal to check errno unless read returns -1, because errno is never actually zeroed out and may still have an "old" value from some other syscall. Our case distinction relied on errno be zeroed out.
- Loading branch information
Showing
1 changed file
with
74 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters