Skip to content

Commit

Permalink
Stringify ERROR_SYSCALL errs in handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
daghf committed Jul 28, 2016
1 parent 39ed8d6 commit 855bd9f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/hitch.c
Original file line number Diff line number Diff line change
Expand Up @@ -2386,6 +2386,8 @@ client_handshake(struct ev_loop *loop, ev_io *w, int revents)
int t;
const char *errtok;
proxystate *ps;
int errno_val;


CAST_OBJ_NOTNULL(ps, w->data, PROXYSTATE_MAGIC);

Expand All @@ -2394,6 +2396,7 @@ client_handshake(struct ev_loop *loop, ev_io *w, int revents)
if (t == 1) {
end_handshake(ps);
} else {
errno_val = errno;
int err = SSL_get_error(ps->ssl, t);
switch (err) {
#define SSL_ERR(a) \
Expand All @@ -2415,6 +2418,11 @@ client_handshake(struct ev_loop *loop, ev_io *w, int revents)
LOG("{%s} Connection closed (in handshake)\n",
w->fd == ps->fd_up ? "client" : "backend");
shutdown_proxy(ps, SHUTDOWN_SSL);
} else if (err == SSL_ERROR_SYSCALL) {
LOG("{%s} SSL socket error in handshake: %s\n",
w->fd == ps->fd_up ? "client" : "backend",
strerror(errno_val));
shutdown_proxy(ps, SHUTDOWN_SSL);
} else {
if (err == SSL_ERROR_SSL) {
log_ssl_error(ps, "Handshake failure");
Expand Down

0 comments on commit 855bd9f

Please sign in to comment.