Also go through the disconnect method that checks we are connected
before passing the conn to xio_disconnect as it might be NULL.
Signed-off-by: Roi Dayan <roid@mellanox.com>
if (cstate.policy.resetcheck)
cstate.flags |= CState::FLAG_RESET;
- // Accelio disconnect
- xio_disconnect(conn);
+ disconnect();
/* XXX this will almost certainly be called again from
* on_disconnect_event() */
xcon->discard_input_queue(flags|OP_FLAG_LOCKED);
xcon->adjust_clru(flags|OP_FLAG_LOCKED|OP_FLAG_LRU);
- // Accelio disconnect
- xio_disconnect(xcon->conn);
+ xcon->disconnect();
if (! (flags & OP_FLAG_LOCKED))
pthread_spin_unlock(&xcon->sp);
delete xcon;
return NULL;
}
- nsessions.inc();
/* this should cause callbacks with user context of conn, but
* we can always set it explicitly */
.out_addr = NULL,
.conn_user_context = xcon
};
+
xcon->conn = xio_connect(&xcp);
+ if (!xcon->conn) {
+ xio_session_destroy(xcon->session);
+ delete xcon;
+ return NULL;
+ }
+
+ nsessions.inc();
xcon->connected.set(true);
/* sentinel ref */