Skip to content

Commit

Permalink
Raise ConnectionAbortedError when we could not read data
Browse files Browse the repository at this point in the history
This is more specific to catch in the SABnzbd code, `ValueError` could also indicate other problems.
  • Loading branch information
Safihre committed Dec 20, 2023
1 parent 65032b8 commit edeedf6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/sabctools.h
Expand Up @@ -22,6 +22,6 @@
#include <string.h>

/* Version information */
#define SABCTOOLS_VERSION "8.0.1"
#define SABCTOOLS_VERSION "8.1.0"

PyMODINIT_FUNC PyInit_sabctools(void);
5 changes: 3 additions & 2 deletions src/unlocked_ssl.cc
Expand Up @@ -218,8 +218,9 @@ static PyObject* unlocked_ssl_recv_into_impl(PySSLSocket *self, Py_ssize_t len,
if (err.ssl == SSL_ERROR_WANT_READ) {
PyErr_SetString(SSLWantReadError, "Need more data");
} else {
// Raise general error, since we don't care
PyErr_SetString(PyExc_ValueError, "Failed to read data");
// Raise general error, as all errors that are left indicate fatal errors
// The calling code will have to establish a new connection
PyErr_SetString(PyExc_ConnectionAbortedError, "Failed to read data");
}
goto error;
}
Expand Down

0 comments on commit edeedf6

Please sign in to comment.