+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* libzebra ZeroMQ bindings
* Copyright (C) 2015 David Lamparter
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* IF YOU MODIFY THIS FILE PLEASE RUN `make check` and ensure that
- * the test_zmq.c unit test is still working. There are dependancies
+ * the test_zmq.c unit test is still working. There are dependencies
* between the two that are extremely fragile. My understanding
* is that there is specialized ownership of the cb pointer based
* upon what is happening. Those assumptions are supposed to be
}
}
-static int frrzmq_read_msg(struct thread *t)
+static void frrzmq_read_msg(struct thread *t)
{
struct frrzmq_cb **cbp = THREAD_ARG(t);
struct frrzmq_cb *cb;
size_t moresz;
if (!cbp)
- return 1;
+ return;
cb = (*cbp);
if (!cb || !cb->zmqsock)
- return 1;
+ return;
while (1) {
zmq_pollitem_t polli = {.socket = cb->zmqsock,
if (cb->write.cancelled && !cb->write.thread)
XFREE(MTYPE_ZEROMQ_CB, *cbp);
- return 0;
+ return;
}
continue;
}
if (cb->write.cancelled && !cb->write.thread)
XFREE(MTYPE_ZEROMQ_CB, *cbp);
- return 0;
+ return;
}
/* cb_part may have read additional parts of the
thread_add_read(t->master, frrzmq_read_msg, cbp,
cb->fd, &cb->read.thread);
- return 0;
+ return;
out_err:
flog_err(EC_LIB_ZMQ, "ZeroMQ read error: %s(%d)", strerror(errno),
errno);
if (cb->read.cb_error)
cb->read.cb_error(cb->read.arg, cb->zmqsock);
- return 1;
}
int _frrzmq_thread_add_read(const struct xref_threadsched *xref,
return 0;
}
-static int frrzmq_write_msg(struct thread *t)
+static void frrzmq_write_msg(struct thread *t)
{
struct frrzmq_cb **cbp = THREAD_ARG(t);
struct frrzmq_cb *cb;
int ret;
if (!cbp)
- return 1;
+ return;
cb = (*cbp);
if (!cb || !cb->zmqsock)
- return 1;
+ return;
while (1) {
zmq_pollitem_t polli = {.socket = cb->zmqsock,
if (cb->read.cancelled && !cb->read.thread)
XFREE(MTYPE_ZEROMQ_CB, *cbp);
- return 0;
+ return;
}
continue;
}
thread_add_write(t->master, frrzmq_write_msg, cbp,
cb->fd, &cb->write.thread);
- return 0;
+ return;
out_err:
flog_err(EC_LIB_ZMQ, "ZeroMQ write error: %s(%d)", strerror(errno),
errno);
if (cb->write.cb_error)
cb->write.cb_error(cb->write.arg, cb->zmqsock);
- return 1;
}
int _frrzmq_thread_add_write(const struct xref_threadsched *xref,