mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-12 05:48:51 -04:00
Merge remote-tracking branch 'ppelleti/preserve-errno'
This commit is contained in:
commit
29fea33a7c
7
http.c
7
http.c
@ -681,6 +681,7 @@ void
|
|||||||
evhttp_connection_fail_(struct evhttp_connection *evcon,
|
evhttp_connection_fail_(struct evhttp_connection *evcon,
|
||||||
enum evhttp_connection_error error)
|
enum evhttp_connection_error error)
|
||||||
{
|
{
|
||||||
|
const int errsave = errno;
|
||||||
struct evhttp_request* req = TAILQ_FIRST(&evcon->requests);
|
struct evhttp_request* req = TAILQ_FIRST(&evcon->requests);
|
||||||
void (*cb)(struct evhttp_request *, void *);
|
void (*cb)(struct evhttp_request *, void *);
|
||||||
void *cb_arg;
|
void *cb_arg;
|
||||||
@ -726,6 +727,12 @@ evhttp_connection_fail_(struct evhttp_connection *evcon,
|
|||||||
if (TAILQ_FIRST(&evcon->requests) != NULL)
|
if (TAILQ_FIRST(&evcon->requests) != NULL)
|
||||||
evhttp_connection_connect_(evcon);
|
evhttp_connection_connect_(evcon);
|
||||||
|
|
||||||
|
/* The call to evhttp_connection_reset_ overwrote errno.
|
||||||
|
* Let's restore the original errno, so that the user's
|
||||||
|
* callback can have a better idea of what the error was.
|
||||||
|
*/
|
||||||
|
errno = errsave;
|
||||||
|
|
||||||
/* inform the user */
|
/* inform the user */
|
||||||
if (cb != NULL)
|
if (cb != NULL)
|
||||||
(*cb)(NULL, cb_arg);
|
(*cb)(NULL, cb_arg);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user