|
|
@ -177,18 +177,23 @@ static int drop_client(conn_instance_t *ci, client_instance_t *client) |
|
|
|
return fd; |
|
|
|
return fd; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void stratifier_drop_client(ckpool_t *ckp, int64_t id) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
char buf[256]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sprintf(buf, "dropclient=%ld", id); |
|
|
|
|
|
|
|
send_proc(ckp->stratifier, buf); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Invalidate this instance. Remove them from the hashtables we look up
|
|
|
|
/* Invalidate this instance. Remove them from the hashtables we look up
|
|
|
|
* regularly but keep the instances in a linked list indefinitely in case we |
|
|
|
* regularly but keep the instances in a linked list indefinitely in case we |
|
|
|
* still reference any of its members. */ |
|
|
|
* still reference any of its members. */ |
|
|
|
static void invalidate_client(ckpool_t *ckp, conn_instance_t *ci, client_instance_t *client) |
|
|
|
static void invalidate_client(ckpool_t *ckp, conn_instance_t *ci, client_instance_t *client) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char buf[256]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drop_client(ci, client); |
|
|
|
drop_client(ci, client); |
|
|
|
if (ckp->passthrough) |
|
|
|
if (ckp->passthrough) |
|
|
|
return; |
|
|
|
return; |
|
|
|
sprintf(buf, "dropclient=%ld", client->id); |
|
|
|
stratifier_drop_client(ckp, client->id); |
|
|
|
send_proc(ckp->stratifier, buf); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void send_client(conn_instance_t *ci, int64_t id, char *buf); |
|
|
|
static void send_client(conn_instance_t *ci, int64_t id, char *buf); |
|
|
@ -492,12 +497,16 @@ static void send_client(conn_instance_t *ci, int64_t id, char *buf) |
|
|
|
ck_runlock(&ci->lock); |
|
|
|
ck_runlock(&ci->lock); |
|
|
|
|
|
|
|
|
|
|
|
if (unlikely(fd == -1)) { |
|
|
|
if (unlikely(fd == -1)) { |
|
|
|
|
|
|
|
ckpool_t *ckp = ci->pi->ckp; |
|
|
|
|
|
|
|
|
|
|
|
if (client) { |
|
|
|
if (client) { |
|
|
|
/* This shouldn't happen */ |
|
|
|
/* This shouldn't happen */ |
|
|
|
LOGWARNING("Client id %ld disconnected but fd already invalidated!", id); |
|
|
|
LOGWARNING("Client id %ld disconnected but fd already invalidated!", id); |
|
|
|
invalidate_client(ci->pi->ckp, ci, client); |
|
|
|
invalidate_client(ckp, ci, client); |
|
|
|
} else |
|
|
|
} else { |
|
|
|
LOGINFO("Connector failed to find client id %ld to send to", id); |
|
|
|
LOGINFO("Connector failed to find client id %ld to send to", id); |
|
|
|
|
|
|
|
stratifier_drop_client(ckp, id); |
|
|
|
|
|
|
|
} |
|
|
|
free(buf); |
|
|
|
free(buf); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|