Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve the real error if accept failed. #82

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion adafruit_httpserver/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ def poll(self) -> str:
if self.stopped:
raise ServerStoppedError

conn = None
try:
conn, client_address = self._sock.accept()
conn.settimeout(self._timeout)
Expand Down Expand Up @@ -405,7 +406,8 @@ def poll(self) -> str:
if self.debug:
_debug_exception_in_handler(error)

conn.close()
if conn is not None:
conn.close()
raise error # Raise the exception again to be handled by the user.

def require_authentication(self, auths: List[Union[Basic, Token, Bearer]]) -> None:
Expand Down