@@ -889,21 +889,7 @@ static void conn_cleanup(conn *c)
889889 }
890890
891891 c->engine_storage = NULL;
892- /* disconnect it from the conn_list of a thread in charge */
893- if (c->conn_prev != NULL) {
894- c->conn_prev->conn_next = c->conn_next;
895- } else {
896- assert(c->thread->conn_list == c);
897- c->thread->conn_list = c->conn_next;
898- }
899- if (c->conn_next != NULL) {
900- c->conn_next->conn_prev = c->conn_prev;
901- }
902- c->thread = NULL;
903- assert(c->next == NULL);
904892 c->ascii_cmd = NULL;
905- c->sfd = -1;
906-
907893 c->ewouldblock = false;
908894 c->io_blocked = false;
909895#ifdef MULTI_NOTIFY_IO_COMPLETE
@@ -942,6 +928,18 @@ void conn_close(conn *c)
942928 remove_io_pending(c);
943929
944930 conn_cleanup(c);
931+ /* disconnect it from the conn_list of a thread in charge */
932+ if (c->conn_prev != NULL) {
933+ c->conn_prev->conn_next = c->conn_next;
934+ } else {
935+ assert(c->thread->conn_list == c);
936+ c->thread->conn_list = c->conn_next;
937+ }
938+ if (c->conn_next != NULL) {
939+ c->conn_next->conn_prev = c->conn_prev;
940+ }
941+ c->thread = NULL;
942+ assert(c->next == NULL);
945943
946944 /*
947945 * The contract with the object cache is that we should return the
@@ -13596,10 +13594,7 @@ static enum transmit_result transmit(conn *c)
1359613594 //perror("Failed to write, and not due to blocking");
1359713595 }
1359813596
13599- if (IS_UDP(c->transport))
13600- conn_set_state(c, conn_read);
13601- else
13602- conn_set_state(c, conn_closing);
13597+ conn_set_state(c, conn_closing);
1360313598 return TRANSMIT_HARD_ERROR;
1360413599 } else {
1360513600 return TRANSMIT_COMPLETE;
@@ -14030,6 +14025,7 @@ bool conn_closing(conn *c)
1403014025{
1403114026 if (IS_UDP(c->transport)) {
1403214027 conn_cleanup(c);
14028+ conn_set_state(c, conn_read);
1403314029 } else {
1403414030 conn_close(c);
1403514031 }
0 commit comments