Browse Source

Use async send proc in the connector

master
Con Kolivas 10 years ago
parent
commit
a465e47f85
  1. 10
      src/connector.c

10
src/connector.c

@ -97,6 +97,8 @@ struct connector_data {
/* For protecting the pending sends list */ /* For protecting the pending sends list */
mutex_t sender_lock; mutex_t sender_lock;
pthread_cond_t sender_cond; pthread_cond_t sender_cond;
ckwq_t *ckwqs;
}; };
typedef struct connector_data cdata_t; typedef struct connector_data cdata_t;
@ -242,7 +244,7 @@ static void stratifier_drop_client(ckpool_t *ckp, int64_t id)
char buf[256]; char buf[256];
sprintf(buf, "dropclient=%"PRId64, id); sprintf(buf, "dropclient=%"PRId64, id);
send_proc(ckp->stratifier, buf); async_send_proc(ckp, 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
@ -361,9 +363,9 @@ reparse:
* filtered by the stratifier. */ * filtered by the stratifier. */
if (likely(client->fd != -1)) { if (likely(client->fd != -1)) {
if (ckp->passthrough) if (ckp->passthrough)
send_proc(ckp->generator, s); async_send_proc(ckp, ckp->generator, s);
else else
send_proc(ckp->stratifier, s); async_send_proc(ckp, ckp->stratifier, s);
} }
free(s); free(s);
@ -861,6 +863,8 @@ int connector(proc_instance_t *pi)
LOGWARNING("%s connector starting", ckp->name); LOGWARNING("%s connector starting", ckp->name);
ckp->data = cdata; ckp->data = cdata;
cdata->ckp = ckp; cdata->ckp = ckp;
/* Connector only requires one work queue */
ckp->ckwqs = cdata->ckwqs = create_ckwqs(ckp, "conn", 1);
if (!ckp->serverurls) if (!ckp->serverurls)
cdata->serverfd = ckalloc(sizeof(int *)); cdata->serverfd = ckalloc(sizeof(int *));

Loading…
Cancel
Save