Commit c1423c01 authored by yixiang's avatar yixiang Committed by Oran Agra
Browse files

Fix connGetSocketError usage (#7811)


(cherry picked from commit b96c3595)
parent ecf51b0b
...@@ -261,8 +261,9 @@ static void connSocketEventHandler(struct aeEventLoop *el, int fd, void *clientD ...@@ -261,8 +261,9 @@ static void connSocketEventHandler(struct aeEventLoop *el, int fd, void *clientD
if (conn->state == CONN_STATE_CONNECTING && if (conn->state == CONN_STATE_CONNECTING &&
(mask & AE_WRITABLE) && conn->conn_handler) { (mask & AE_WRITABLE) && conn->conn_handler) {
if (connGetSocketError(conn)) { int conn_error = connGetSocketError(conn);
conn->last_errno = errno; if (conn_error) {
conn->last_errno = conn_error;
conn->state = CONN_STATE_ERROR; conn->state = CONN_STATE_ERROR;
} else { } else {
conn->state = CONN_STATE_CONNECTED; conn->state = CONN_STATE_CONNECTED;
......
...@@ -464,8 +464,9 @@ static void tlsHandleEvent(tls_connection *conn, int mask) { ...@@ -464,8 +464,9 @@ static void tlsHandleEvent(tls_connection *conn, int mask) {
switch (conn->c.state) { switch (conn->c.state) {
case CONN_STATE_CONNECTING: case CONN_STATE_CONNECTING:
if (connGetSocketError((connection *) conn)) { int conn_error = connGetSocketError((connection *) conn);
conn->c.last_errno = errno; if (conn_error) {
conn->c.last_errno = conn_error;
conn->c.state = CONN_STATE_ERROR; conn->c.state = CONN_STATE_ERROR;
} else { } else {
if (!(conn->flags & TLS_CONN_FLAG_FD_SET)) { if (!(conn->flags & TLS_CONN_FLAG_FD_SET)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment