kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 1003cbcd503534e5ca9f47da8e295e9ca180b9ca
parent 0281fb7b99604665820a6a60513ae27e84355fb4
Author: Joris Vink <joris@coders.se>
Date:   Tue,  7 Jul 2015 16:11:40 +0200

Just point hldr_extra to kw->id.

Not sure what state of crazy my mind was in for writing
the previous code like that.

Diffstat:
src/msg.c | 8+-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/msg.c b/src/msg.c @@ -60,18 +60,13 @@ kore_msg_parent_init(void) void kore_msg_parent_add(struct kore_worker *kw) { - u_int8_t *worker_id; - - worker_id = kore_malloc(sizeof(*worker_id)); - *worker_id = kw->id; - kw->msg[0] = kore_connection_new(NULL); kw->msg[0]->fd = kw->pipe[0]; kw->msg[0]->read = net_read; kw->msg[0]->write = net_write; kw->msg[0]->proto = CONN_PROTO_MSG; kw->msg[0]->state = CONN_STATE_ESTABLISHED; - kw->msg[0]->hdlr_extra = worker_id; + kw->msg[0]->hdlr_extra = &kw->id; kw->msg[0]->disconnect = msg_disconnected_worker; TAILQ_INSERT_TAIL(&connections, kw->msg[0], list); @@ -201,7 +196,6 @@ msg_disconnected_parent(struct connection *c) static void msg_disconnected_worker(struct connection *c) { - kore_mem_free(c->hdlr_extra); c->hdlr_extra = NULL; }