aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/reqrep0
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol/reqrep0')
-rw-r--r--src/protocol/reqrep0/rep.c61
-rw-r--r--src/protocol/reqrep0/req.c94
-rw-r--r--src/protocol/reqrep0/xrep.c30
-rw-r--r--src/protocol/reqrep0/xreq.c28
4 files changed, 74 insertions, 139 deletions
diff --git a/src/protocol/reqrep0/rep.c b/src/protocol/reqrep0/rep.c
index 142edb9b..328babbc 100644
--- a/src/protocol/reqrep0/rep.c
+++ b/src/protocol/reqrep0/rep.c
@@ -53,7 +53,7 @@ struct rep0_sock {
nni_idhash * pipes;
nni_list recvpipes; // list of pipes with data to receive
nni_list recvq;
- rep0_ctx * ctx;
+ rep0_ctx ctx;
nni_pollable *recvable;
nni_pollable *sendable;
};
@@ -99,25 +99,19 @@ rep0_ctx_fini(void *arg)
rep0_ctx *ctx = arg;
rep0_ctx_close(ctx);
- NNI_FREE_STRUCT(ctx);
}
static int
-rep0_ctx_init(void **ctxp, void *sarg)
+rep0_ctx_init(void *carg, void *sarg)
{
- rep0_sock *s = sarg;
- rep0_ctx * ctx;
-
- if ((ctx = NNI_ALLOC_STRUCT(ctx)) == NULL) {
- return (NNG_ENOMEM);
- }
+ rep0_sock *s = sarg;
+ rep0_ctx * ctx = carg;
NNI_LIST_NODE_INIT(&ctx->sqnode);
NNI_LIST_NODE_INIT(&ctx->rqnode);
ctx->btrace_len = 0;
ctx->sock = s;
ctx->pipe_id = 0;
- *ctxp = ctx;
return (0);
}
@@ -168,7 +162,7 @@ rep0_ctx_send(void *arg, nni_aio *aio)
ctx->btrace_len = 0;
ctx->pipe_id = 0;
- if (ctx == s->ctx) {
+ if (ctx == &s->ctx) {
// No matter how this goes, we will no longer be able
// to send on the socket (root context). That's because
// we will have finished (successfully or otherwise) the
@@ -225,26 +219,20 @@ rep0_sock_fini(void *arg)
rep0_sock *s = arg;
nni_idhash_fini(s->pipes);
- if (s->ctx != NULL) {
- rep0_ctx_fini(s->ctx);
- }
+ rep0_ctx_fini(&s->ctx);
nni_pollable_free(s->sendable);
nni_pollable_free(s->recvable);
nni_mtx_fini(&s->lk);
- NNI_FREE_STRUCT(s);
}
static int
-rep0_sock_init(void **sp, nni_sock *sock)
+rep0_sock_init(void *arg, nni_sock *sock)
{
- rep0_sock *s;
+ rep0_sock *s = arg;
int rv;
NNI_ARG_UNUSED(sock);
- if ((s = NNI_ALLOC_STRUCT(s)) == NULL) {
- return (NNG_ENOMEM);
- }
nni_mtx_init(&s->lk);
if ((rv = nni_idhash_init(&s->pipes)) != 0) {
rep0_sock_fini(s);
@@ -256,10 +244,7 @@ rep0_sock_init(void **sp, nni_sock *sock)
s->ttl = 8;
- if ((rv = rep0_ctx_init((void **) &s->ctx, s)) != 0) {
- rep0_sock_fini(s);
- return (rv);
- }
+ (void) rep0_ctx_init(&s->ctx, s);
// We start off without being either readable or pollable.
// Readability comes when there is something on the socket.
@@ -269,8 +254,6 @@ rep0_sock_init(void **sp, nni_sock *sock)
return (rv);
}
- *sp = s;
-
return (0);
}
@@ -285,7 +268,7 @@ rep0_sock_close(void *arg)
{
rep0_sock *s = arg;
- rep0_ctx_close(s->ctx);
+ rep0_ctx_close(&s->ctx);
}
static void
@@ -310,18 +293,14 @@ rep0_pipe_fini(void *arg)
nni_aio_fini(p->aio_send);
nni_aio_fini(p->aio_recv);
- NNI_FREE_STRUCT(p);
}
static int
-rep0_pipe_init(void **pp, nni_pipe *pipe, void *s)
+rep0_pipe_init(void *arg, nni_pipe *pipe, void *s)
{
- rep0_pipe *p;
+ rep0_pipe *p = arg;
int rv;
- if ((p = NNI_ALLOC_STRUCT(p)) == NULL) {
- return (NNG_ENOMEM);
- }
if (((rv = nni_aio_init(&p->aio_send, rep0_pipe_send_cb, p)) != 0) ||
((rv = nni_aio_init(&p->aio_recv, rep0_pipe_recv_cb, p)) != 0)) {
rep0_pipe_fini(p);
@@ -333,7 +312,6 @@ rep0_pipe_init(void **pp, nni_pipe *pipe, void *s)
p->id = nni_pipe_id(pipe);
p->pipe = pipe;
p->rep = s;
- *pp = p;
return (0);
}
@@ -386,7 +364,7 @@ rep0_pipe_close(void *arg)
nni_aio_finish(aio, 0, nni_msg_len(msg));
nni_msg_free(msg);
}
- if (p->id == s->ctx->pipe_id) {
+ if (p->id == s->ctx.pipe_id) {
// We "can" send. (Well, not really, but we will happily
// accept a message and discard it.)
nni_pollable_raise(s->sendable);
@@ -415,7 +393,7 @@ rep0_pipe_send_cb(void *arg)
p->busy = false;
if ((ctx = nni_list_first(&p->sendq)) == NULL) {
// Nothing else to send.
- if (p->id == s->ctx->pipe_id) {
+ if (p->id == s->ctx.pipe_id) {
// Mark us ready for the other side to send!
nni_pollable_raise(s->sendable);
}
@@ -494,7 +472,7 @@ rep0_ctx_recv(void *arg, nni_aio *aio)
nni_pollable_clear(s->recvable);
}
nni_pipe_recv(p->pipe, p->aio_recv);
- if ((ctx == s->ctx) && !p->busy) {
+ if ((ctx == &s->ctx) && !p->busy) {
nni_pollable_raise(s->sendable);
}
@@ -578,7 +556,7 @@ rep0_pipe_recv_cb(void *arg)
aio = ctx->raio;
ctx->raio = NULL;
nni_aio_set_msg(p->aio_recv, NULL);
- if ((ctx == s->ctx) && !p->busy) {
+ if ((ctx == &s->ctx) && !p->busy) {
nni_pollable_raise(s->sendable);
}
@@ -650,7 +628,7 @@ rep0_sock_send(void *arg, nni_aio *aio)
{
rep0_sock *s = arg;
- rep0_ctx_send(s->ctx, aio);
+ rep0_ctx_send(&s->ctx, aio);
}
static void
@@ -658,12 +636,13 @@ rep0_sock_recv(void *arg, nni_aio *aio)
{
rep0_sock *s = arg;
- rep0_ctx_recv(s->ctx, aio);
+ rep0_ctx_recv(&s->ctx, aio);
}
// This is the global protocol structure -- our linkage to the core.
// This should be the only global non-static symbol in this file.
static nni_proto_pipe_ops rep0_pipe_ops = {
+ .pipe_size = sizeof(rep0_pipe),
.pipe_init = rep0_pipe_init,
.pipe_fini = rep0_pipe_fini,
.pipe_start = rep0_pipe_start,
@@ -672,6 +651,7 @@ static nni_proto_pipe_ops rep0_pipe_ops = {
};
static nni_proto_ctx_ops rep0_ctx_ops = {
+ .ctx_size = sizeof(rep0_ctx),
.ctx_init = rep0_ctx_init,
.ctx_fini = rep0_ctx_fini,
.ctx_send = rep0_ctx_send,
@@ -699,6 +679,7 @@ static nni_option rep0_sock_options[] = {
};
static nni_proto_sock_ops rep0_sock_ops = {
+ .sock_size = sizeof(rep0_sock),
.sock_init = rep0_sock_init,
.sock_fini = rep0_sock_fini,
.sock_open = rep0_sock_open,
diff --git a/src/protocol/reqrep0/req.c b/src/protocol/reqrep0/req.c
index 010ee8a6..4326f411 100644
--- a/src/protocol/reqrep0/req.c
+++ b/src/protocol/reqrep0/req.c
@@ -1,5 +1,5 @@
//
-// Copyright 2019 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -10,7 +10,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include "core/nng_impl.h"
#include "nng/protocol/reqrep0/req.h"
@@ -35,7 +34,7 @@ static void req0_ctx_reset(req0_ctx *);
static void req0_ctx_timeout(void *);
static void req0_pipe_fini(void *);
static void req0_ctx_fini(void *);
-static int req0_ctx_init(void **, void *);
+static int req0_ctx_init(void *, void *);
// A req0_ctx is a "context" for the request. It uses most of the
// socket, but keeps track of its own outstanding replays, the request ID,
@@ -57,24 +56,19 @@ struct req0_ctx {
// A req0_sock is our per-socket protocol private structure.
struct req0_sock {
- nni_sock * nsock;
- nni_duration retry;
- bool closed;
- int ttl;
-
- req0_ctx *ctx; // base socket ctx
-
- nni_list readypipes;
- nni_list busypipes;
- nni_list stoppipes;
- nni_list ctxs;
-
+ nni_duration retry;
+ bool closed;
+ int ttl;
+ req0_ctx ctx; // base socket ctx
+ nni_list readypipes;
+ nni_list busypipes;
+ nni_list stoppipes;
+ nni_list ctxs;
nni_list sendq; // contexts waiting to send.
nni_idhash * reqids; // contexts by request ID
nni_pollable *recvable;
nni_pollable *sendable;
-
- nni_mtx mtx;
+ nni_mtx mtx;
};
// A req0_pipe is our per-pipe protocol private structure.
@@ -93,16 +87,14 @@ static void req0_send_cb(void *);
static void req0_recv_cb(void *);
static int
-req0_sock_init(void **sp, nni_sock *sock)
+req0_sock_init(void *arg, nni_sock *sock)
{
- req0_sock *s;
+ req0_sock *s = arg;
int rv;
- if ((s = NNI_ALLOC_STRUCT(s)) == NULL) {
- return (NNG_ENOMEM);
- }
+ NNI_ARG_UNUSED(sock);
+
if ((rv = nni_idhash_init(&s->reqids)) != 0) {
- NNI_FREE_STRUCT(s);
return (rv);
}
@@ -121,13 +113,10 @@ req0_sock_init(void **sp, nni_sock *sock)
NNI_LIST_INIT(&s->ctxs, req0_ctx, snode);
// this is "semi random" start for request IDs.
- s->nsock = sock;
s->retry = NNI_SECOND * 60;
- if ((rv = req0_ctx_init((void **) &s->ctx, s)) != 0) {
- req0_sock_fini(s);
- return (rv);
- }
+ (void) req0_ctx_init(&s->ctx, s);
+
if (((rv = nni_pollable_alloc(&s->sendable)) != 0) ||
((rv = nni_pollable_alloc(&s->recvable)) != 0)) {
req0_sock_fini(s);
@@ -135,8 +124,6 @@ req0_sock_init(void **sp, nni_sock *sock)
}
s->ttl = 8;
- *sp = s;
-
return (0);
}
@@ -174,14 +161,12 @@ req0_sock_fini(void *arg)
NNI_ASSERT(nni_list_empty(&s->stoppipes));
NNI_ASSERT(nni_list_empty(&s->readypipes));
nni_mtx_unlock(&s->mtx);
- if (s->ctx) {
- req0_ctx_fini(s->ctx);
- }
+
+ req0_ctx_fini(&s->ctx);
nni_pollable_free(s->recvable);
nni_pollable_free(s->sendable);
nni_idhash_fini(s->reqids);
nni_mtx_fini(&s->mtx);
- NNI_FREE_STRUCT(s);
}
static void
@@ -204,18 +189,14 @@ req0_pipe_fini(void *arg)
nni_aio_fini(p->aio_recv);
nni_aio_fini(p->aio_send);
- NNI_FREE_STRUCT(p);
}
static int
-req0_pipe_init(void **pp, nni_pipe *pipe, void *s)
+req0_pipe_init(void *arg, nni_pipe *pipe, void *s)
{
- req0_pipe *p;
+ req0_pipe *p = arg;
int rv;
- if ((p = NNI_ALLOC_STRUCT(p)) == NULL) {
- return (NNG_ENOMEM);
- }
if (((rv = nni_aio_init(&p->aio_recv, req0_recv_cb, p)) != 0) ||
((rv = nni_aio_init(&p->aio_send, req0_send_cb, p)) != 0)) {
req0_pipe_fini(p);
@@ -226,7 +207,6 @@ req0_pipe_init(void **pp, nni_pipe *pipe, void *s)
NNI_LIST_INIT(&p->ctxs, req0_ctx, pnode);
p->pipe = pipe;
p->req = s;
- *pp = p;
return (0);
}
@@ -398,7 +378,7 @@ req0_recv_cb(void *arg)
} else {
// No AIO, so stash msg. Receive will pick it up later.
ctx->repmsg = msg;
- if (ctx == s->ctx) {
+ if (ctx == &s->ctx) {
nni_pollable_raise(s->recvable);
}
nni_mtx_unlock(&s->mtx);
@@ -427,14 +407,10 @@ req0_ctx_timeout(void *arg)
}
static int
-req0_ctx_init(void **cpp, void *sarg)
+req0_ctx_init(void *carg, void *sarg)
{
- req0_sock *s = sarg;
- req0_ctx * ctx;
-
- if ((ctx = NNI_ALLOC_STRUCT(ctx)) == NULL) {
- return (NNG_ENOMEM);
- }
+ req0_sock *s = sarg;
+ req0_ctx * ctx = carg;
nni_timer_init(&ctx->timer, req0_ctx_timeout, ctx);
@@ -445,7 +421,6 @@ req0_ctx_init(void **cpp, void *sarg)
nni_list_append(&s->ctxs, ctx);
nni_mtx_unlock(&s->mtx);
- *cpp = ctx;
return (0);
}
@@ -473,8 +448,6 @@ req0_ctx_fini(void *arg)
nni_timer_cancel(&ctx->timer);
nni_timer_fini(&ctx->timer);
-
- NNI_FREE_STRUCT(ctx);
}
static int
@@ -547,7 +520,7 @@ req0_run_sendq(req0_sock *s, nni_list *aiolist)
} else {
nni_aio_finish(aio, 0, 0);
}
- if (ctx == s->ctx) {
+ if (ctx == &s->ctx) {
if (nni_list_empty(&s->readypipes)) {
nni_pollable_clear(s->sendable);
} else {
@@ -662,7 +635,7 @@ req0_ctx_recv(void *arg, nni_aio *aio)
// We have got a message to pass up, yay!
nni_aio_set_msg(aio, msg);
- if (ctx == s->ctx) {
+ if (ctx == &s->ctx) {
nni_pollable_clear(s->recvable);
}
nni_mtx_unlock(&s->mtx);
@@ -779,14 +752,14 @@ static void
req0_sock_send(void *arg, nni_aio *aio)
{
req0_sock *s = arg;
- req0_ctx_send(s->ctx, aio);
+ req0_ctx_send(&s->ctx, aio);
}
static void
req0_sock_recv(void *arg, nni_aio *aio)
{
req0_sock *s = arg;
- req0_ctx_recv(s->ctx, aio);
+ req0_ctx_recv(&s->ctx, aio);
}
static int
@@ -808,8 +781,8 @@ req0_sock_set_resendtime(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
req0_sock *s = arg;
int rv;
- rv = req0_ctx_set_resendtime(s->ctx, buf, sz, t);
- s->retry = s->ctx->retry;
+ rv = req0_ctx_set_resendtime(&s->ctx, buf, sz, t);
+ s->retry = s->ctx.retry;
return (rv);
}
@@ -817,7 +790,7 @@ static int
req0_sock_get_resendtime(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
req0_sock *s = arg;
- return (req0_ctx_get_resendtime(s->ctx, buf, szp, t));
+ return (req0_ctx_get_resendtime(&s->ctx, buf, szp, t));
}
static int
@@ -848,6 +821,7 @@ req0_sock_get_recvfd(void *arg, void *buf, size_t *szp, nni_opt_type t)
}
static nni_proto_pipe_ops req0_pipe_ops = {
+ .pipe_size = sizeof(req0_pipe),
.pipe_init = req0_pipe_init,
.pipe_fini = req0_pipe_fini,
.pipe_start = req0_pipe_start,
@@ -867,6 +841,7 @@ static nni_option req0_ctx_options[] = {
};
static nni_proto_ctx_ops req0_ctx_ops = {
+ .ctx_size = sizeof(req0_ctx),
.ctx_init = req0_ctx_init,
.ctx_fini = req0_ctx_fini,
.ctx_recv = req0_ctx_recv,
@@ -900,6 +875,7 @@ static nni_option req0_sock_options[] = {
};
static nni_proto_sock_ops req0_sock_ops = {
+ .sock_size = sizeof(req0_sock),
.sock_init = req0_sock_init,
.sock_fini = req0_sock_fini,
.sock_open = req0_sock_open,
diff --git a/src/protocol/reqrep0/xrep.c b/src/protocol/reqrep0/xrep.c
index 09c11cda..48f74075 100644
--- a/src/protocol/reqrep0/xrep.c
+++ b/src/protocol/reqrep0/xrep.c
@@ -1,5 +1,5 @@
//
-// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -65,18 +65,14 @@ xrep0_sock_fini(void *arg)
nni_aio_fini(s->aio_getq);
nni_idhash_fini(s->pipes);
nni_mtx_fini(&s->lk);
- NNI_FREE_STRUCT(s);
}
static int
-xrep0_sock_init(void **sp, nni_sock *sock)
+xrep0_sock_init(void *arg, nni_sock *sock)
{
- xrep0_sock *s;
+ xrep0_sock *s = arg;
int rv;
- if ((s = NNI_ALLOC_STRUCT(s)) == NULL) {
- return (NNG_ENOMEM);
- }
nni_mtx_init(&s->lk);
if (((rv = nni_idhash_init(&s->pipes)) != 0) ||
((rv = nni_aio_init(&s->aio_getq, xrep0_sock_getq_cb, s)) != 0)) {
@@ -88,8 +84,6 @@ xrep0_sock_init(void **sp, nni_sock *sock)
s->uwq = nni_sock_sendq(sock);
s->urq = nni_sock_recvq(sock);
- *sp = s;
-
return (0);
}
@@ -131,20 +125,15 @@ xrep0_pipe_fini(void *arg)
nni_aio_fini(p->aio_recv);
nni_aio_fini(p->aio_putq);
nni_msgq_fini(p->sendq);
- NNI_FREE_STRUCT(p);
}
static int
-xrep0_pipe_init(void **pp, nni_pipe *pipe, void *s)
+xrep0_pipe_init(void *arg, nni_pipe *pipe, void *s)
{
- xrep0_pipe *p;
+ xrep0_pipe *p = arg;
int rv;
- if ((p = NNI_ALLOC_STRUCT(p)) == NULL) {
- return (NNG_ENOMEM);
- }
-
- // We want a pretty deep sendq on pipes. The rationale here is
+ // We want a pretty deep send queue on pipes. The rationale here is
// that the send rate will be mitigated by the receive rate.
// If a slow pipe (req pipe not reading its own responses!?)
// comes up, then we will start discarding its replies eventually,
@@ -152,7 +141,7 @@ xrep0_pipe_init(void **pp, nni_pipe *pipe, void *s)
// smash us with requests, but be unable to handle replies faster
// than we can forward them. If they do that, their replies get
// dropped. (From a DDoS perspective, it might be nice in the
- // future if we had a way to exert backpressure to the send side --
+ // future if we had a way to exert back pressure to the send side --
// essentially don't let peers send requests faster than they are
// willing to receive replies. Something to think about for the
// future.)
@@ -167,7 +156,6 @@ xrep0_pipe_init(void **pp, nni_pipe *pipe, void *s)
p->pipe = pipe;
p->rep = s;
- *pp = p;
return (0);
}
@@ -331,7 +319,7 @@ xrep0_pipe_recv_cb(void *arg)
return;
}
body = nni_msg_body(msg);
- end = ((body[0] & 0x80) != 0);
+ end = ((body[0] & 0x80u) != 0);
if (nni_msg_header_append(msg, body, 4) != 0) {
// Out of memory most likely, but keep going to
// avoid breaking things.
@@ -401,6 +389,7 @@ xrep0_sock_recv(void *arg, nni_aio *aio)
// This is the global protocol structure -- our linkage to the core.
// This should be the only global non-static symbol in this file.
static nni_proto_pipe_ops xrep0_pipe_ops = {
+ .pipe_size = sizeof(xrep0_pipe),
.pipe_init = xrep0_pipe_init,
.pipe_fini = xrep0_pipe_fini,
.pipe_start = xrep0_pipe_start,
@@ -421,6 +410,7 @@ static nni_option xrep0_sock_options[] = {
};
static nni_proto_sock_ops xrep0_sock_ops = {
+ .sock_size = sizeof(xrep0_sock),
.sock_init = xrep0_sock_init,
.sock_fini = xrep0_sock_fini,
.sock_open = xrep0_sock_open,
diff --git a/src/protocol/reqrep0/xreq.c b/src/protocol/reqrep0/xreq.c
index 119b2449..7455c986 100644
--- a/src/protocol/reqrep0/xreq.c
+++ b/src/protocol/reqrep0/xreq.c
@@ -1,5 +1,5 @@
//
-// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -9,8 +9,6 @@
//
#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include "core/nng_impl.h"
#include "nng/protocol/reqrep0/req.h"
@@ -53,18 +51,13 @@ static void xreq0_recv_cb(void *);
static void xreq0_putq_cb(void *);
static int
-xreq0_sock_init(void **sp, nni_sock *sock)
+xreq0_sock_init(void *arg, nni_sock *sock)
{
- xreq0_sock *s;
-
- if ((s = NNI_ALLOC_STRUCT(s)) == NULL) {
- return (NNG_ENOMEM);
- }
+ xreq0_sock *s = arg;
s->ttl = 8;
s->uwq = nni_sock_sendq(sock);
s->urq = nni_sock_recvq(sock);
- *sp = s;
return (0);
}
@@ -84,9 +77,7 @@ xreq0_sock_close(void *arg)
static void
xreq0_sock_fini(void *arg)
{
- xreq0_sock *s = arg;
-
- NNI_FREE_STRUCT(s);
+ NNI_ARG_UNUSED(arg);
}
static void
@@ -109,18 +100,14 @@ xreq0_pipe_fini(void *arg)
nni_aio_fini(p->aio_putq);
nni_aio_fini(p->aio_recv);
nni_aio_fini(p->aio_send);
- NNI_FREE_STRUCT(p);
}
static int
-xreq0_pipe_init(void **pp, nni_pipe *pipe, void *s)
+xreq0_pipe_init(void *arg, nni_pipe *pipe, void *s)
{
- xreq0_pipe *p;
+ xreq0_pipe *p = arg;
int rv;
- if ((p = NNI_ALLOC_STRUCT(p)) == NULL) {
- return (NNG_ENOMEM);
- }
if (((rv = nni_aio_init(&p->aio_getq, xreq0_getq_cb, p)) != 0) ||
((rv = nni_aio_init(&p->aio_putq, xreq0_putq_cb, p)) != 0) ||
((rv = nni_aio_init(&p->aio_recv, xreq0_recv_cb, p)) != 0) ||
@@ -131,7 +118,6 @@ xreq0_pipe_init(void **pp, nni_pipe *pipe, void *s)
p->pipe = pipe;
p->req = s;
- *pp = p;
return (0);
}
@@ -282,6 +268,7 @@ xreq0_sock_get_maxttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
}
static nni_proto_pipe_ops xreq0_pipe_ops = {
+ .pipe_size = sizeof(xreq0_pipe),
.pipe_init = xreq0_pipe_init,
.pipe_fini = xreq0_pipe_fini,
.pipe_start = xreq0_pipe_start,
@@ -302,6 +289,7 @@ static nni_option xreq0_sock_options[] = {
};
static nni_proto_sock_ops xreq0_sock_ops = {
+ .sock_size = sizeof(xreq0_sock),
.sock_init = xreq0_sock_init,
.sock_fini = xreq0_sock_fini,
.sock_open = xreq0_sock_open,