master
Nicolas Favre-Felix 14 years ago
parent cf80196f80
commit 7aab776967

12
cmd.c

@ -35,11 +35,9 @@ cmd_free(struct cmd *c) {
free(c);
}
struct pubsub_client {
struct server *s;
struct evhttp_request *rq;
};
/**
* Detect disconnection of a pub/sub client. We need to clean up the command.
*/
void on_http_disconnect(struct evhttp_connection *evcon, void *ctx) {
struct pubsub_client *ps = ctx;
@ -139,7 +137,7 @@ cmd_run(struct server *s, struct evhttp_request *rq,
evhttp_parse_query(uri, &cmd->uri_params);
/* get output formatting function */
fun = get_formatting_funtion(&cmd->uri_params);
fun = get_formatting_function(&cmd->uri_params);
/* there is always a first parameter, it's the command name */
cmd->argv[0] = uri;
@ -194,7 +192,7 @@ cmd_run(struct server *s, struct evhttp_request *rq,
formatting_fun
get_formatting_funtion(struct evkeyvalq *params) {
get_formatting_function(struct evkeyvalq *params) {
struct evkeyval *kv;

@ -24,6 +24,11 @@ struct cmd {
int started_responding;
};
struct pubsub_client {
struct server *s;
struct evhttp_request *rq;
};
struct cmd *
cmd_new(struct evhttp_request *rq, int count);
@ -35,7 +40,7 @@ cmd_run(struct server *s, struct evhttp_request *rq,
const char *uri, size_t uri_len);
formatting_fun
get_formatting_funtion(struct evkeyvalq *params);
get_formatting_function(struct evkeyvalq *params);
int
cmd_is_subscribe(struct cmd *cmd);

@ -6,8 +6,6 @@
#include <hiredis/hiredis.h>
#include <hiredis/async.h>
extern int __redisPushCallback(redisCallbackList *list, redisCallback *source);
static json_t *
json_wrap_redis_reply(const struct cmd *cmd, const redisReply *r);

@ -66,11 +66,6 @@ webdis_connect(struct server *s) {
evtimer_add(&s->ev_reconnect, &s->tv_reconnect);
}
static void
turnip_connect_now(struct server *s) {
on_timer_reconnect(0, 0, s);
}
struct server *
server_copy(const struct server *s) {
struct server *ret = calloc(1, sizeof(struct server));
@ -79,7 +74,7 @@ server_copy(const struct server *s) {
/* create a new connection */
ret->ac = NULL;
turnip_connect_now(ret);
on_timer_reconnect(0, 0, ret);
return ret;
}

Loading…
Cancel
Save