Skip to content

Commit e73bc2e

Browse files
committed
I am the world's biggest moron.
of course there's a race condition, if you close the bloody socket before setting the state to conn_closed. The amount of time I looked straight at it and didn't see it is causing me physical pain.
1 parent 8278df6 commit e73bc2e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

memcached.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,8 @@ static void conn_close(conn *c) {
568568
conn_cleanup(c);
569569

570570
MEMCACHED_CONN_RELEASE(c->sfd);
571-
close(c->sfd);
572571
conn_set_state(c, conn_closed);
572+
close(c->sfd);
573573

574574
pthread_mutex_lock(&conn_lock);
575575
allow_new_conns = true;
@@ -4321,9 +4321,8 @@ static void drive_machine(conn *c) {
43214321
break;
43224322

43234323
case conn_closed:
4324-
/* This possibly only ever happens if you have built against a
4325-
* broken libevent and event_del fails. */
4326-
stop = true;
4324+
/* This only happens if dormando is an idiot. */
4325+
abort();
43274326
break;
43284327

43294328
case conn_max_state:

0 commit comments

Comments
 (0)