kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit a4a86494b8442a22e047351f4b453d9e64998984
parent a4298206a73626537143f189fcd87cb4464a1a99
Author: Joris Vink <joris@coders.se>
Date:   Mon, 16 Mar 2015 16:52:40 +0100

Bring net_recv_expand() in line with others.

Diffstat:
includes/kore.h | 2+-
src/net.c | 6++----
src/spdy.c | 4++--
src/websocket.c | 4++--
4 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/includes/kore.h b/includes/kore.h @@ -510,7 +510,7 @@ void net_recv_reset(struct connection *, u_int32_t, void net_remove_netbuf(struct netbuf_head *, struct netbuf *); void net_recv_queue(struct connection *, u_int32_t, int, int (*cb)(struct netbuf *)); -void net_recv_expand(struct connection *c, u_int32_t, void *, +void net_recv_expand(struct connection *c, u_int32_t, int (*cb)(struct netbuf *)); void net_send_queue(struct connection *, void *, u_int32_t, struct spdy_stream *, int); diff --git a/src/net.c b/src/net.c @@ -166,17 +166,15 @@ net_recv_queue(struct connection *c, u_int32_t len, int flags, } void -net_recv_expand(struct connection *c, u_int32_t len, void *extra, - int (*cb)(struct netbuf *)) +net_recv_expand(struct connection *c, u_int32_t len, int (*cb)(struct netbuf *)) { - kore_debug("net_recv_expand(): %p %d %p", c, len, extra); + kore_debug("net_recv_expand(): %p %d", c, len); if (c->rnb->type != NETBUF_RECV) fatal("net_recv_expand(): wrong netbuf type"); c->rnb->cb = cb; c->rnb->b_len += len; - c->rnb->extra = extra; c->rnb->m_len = c->rnb->b_len; c->rnb->buf = kore_realloc(c->rnb->buf, c->rnb->b_len); } diff --git a/src/spdy.c b/src/spdy.c @@ -100,7 +100,7 @@ spdy_frame_recv(struct netbuf *nb) r = KORE_RESULT_OK; if (cb != NULL) { - net_recv_expand(c, ctrl.length, NULL, cb); + net_recv_expand(c, ctrl.length, cb); } else { kore_debug("no callback for type %u", ctrl.type); } @@ -124,7 +124,7 @@ spdy_frame_recv(struct netbuf *nb) r = KORE_RESULT_ERROR; } else { r = KORE_RESULT_OK; - net_recv_expand(c, data.length, NULL, + net_recv_expand(c, data.length, spdy_data_frame_recv); } } diff --git a/src/websocket.c b/src/websocket.c @@ -237,7 +237,7 @@ websocket_recv_opcode(struct netbuf *nb) } len += WEBSOCKET_MASK_LEN; - net_recv_expand(c, len, NULL, websocket_recv_frame); + net_recv_expand(c, len, websocket_recv_frame); return (KORE_RESULT_OK); } @@ -283,7 +283,7 @@ websocket_recv_frame(struct netbuf *nb) total = len + extra + WEBSOCKET_MASK_LEN; if (total > nb->b_len) { total -= nb->b_len; - net_recv_expand(c, total, NULL, websocket_recv_frame); + net_recv_expand(c, total, websocket_recv_frame); return (KORE_RESULT_OK); }