fail_protocol(con);
return -1;
}
+ clear_bit(NEGOTIATING, &con->state);
clear_bit(CONNECTING, &con->state);
con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq);
con->connect_seq++;
/* open the socket first? */
if (con->sock == NULL) {
- clear_bit(NEGOTIATING, &con->state);
set_bit(CONNECTING, &con->state);
con_out_kvec_reset(con);
mutex_lock(&con->mutex);
restart:
if (test_and_clear_bit(SOCK_CLOSED, &con->flags)) {
- if (test_and_clear_bit(CONNECTING, &con->state))
+ if (test_and_clear_bit(CONNECTING, &con->state)) {
+ clear_bit(NEGOTIATING, &con->state);
con->error_msg = "connection failed";
- else
+ } else {
con->error_msg = "socket closed";
+ }
goto fault;
}