summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wimaxll.h5
-rw-r--r--lib/op-open.c18
2 files changed, 13 insertions, 10 deletions
diff --git a/include/wimaxll.h b/include/wimaxll.h
index c2469f2..87253bb 100644
--- a/include/wimaxll.h
+++ b/include/wimaxll.h
@@ -242,6 +242,11 @@ struct nlattr;
*
* Callbacks are always passed a pointer to a private context as set
* by the application.
+ *
+ * Callbacks can return -%EBUSY to have wimaxll_recv() stop processing
+ * messages and pass control to the caller (which will see it
+ * returning -%EBUSY). Callbacks *SHOULD NOT* return -%EINPROGRESS, as
+ * it is used internally by wimaxll_recv().
*/
diff --git a/lib/op-open.c b/lib/op-open.c
index a81af81..73019d9 100644
--- a/lib/op-open.c
+++ b/lib/op-open.c
@@ -108,10 +108,8 @@ static
*
* Called by nl_recvmsgs() when a valid message is received. We
* multiplex and handle messages that are known to the library. If the
- * message is unknown, do nothing other than setting -ENODATA.
- *
- * In wimaxll_recv(), -ENODATA is considered a retryable error --
- * effectively, the message is skipped.
+ * message is unknown, do nothing other than maybe printing an error
+ * message.
*
* The wimaxll_gnl_handle_*() functions need to return:
*
@@ -153,7 +151,7 @@ int wimaxll_gnl_cb(struct nl_msg *msg, void *_ctx)
default:
d_printf(3, wmx, "E: %s: received unknown gnl message %d\n",
__func__, gnl_hdr->cmd);
- result = -ENODATA;
+ result = 0;
}
if (result == -EBUSY) { /* stop signal from the user's callback */
result_nl = NL_STOP;
@@ -197,9 +195,7 @@ int wimaxll_recv_fd(struct wimaxll_handle *wmx)
* implementation of the callback). On error, a negative errno
* code:
*
- * -%EINPROGRESS: the message was not received.
- *
- * -%ENODATA: messages were received, but none of the known types.
+ * -%EBUSY: callback instructed to stop processing messages
*
* Read one or more messages from a multicast group and for each valid
* one, execute the callbacks set in the multi cast handle.
@@ -247,13 +243,15 @@ ssize_t wimaxll_recv(struct wimaxll_handle *wmx)
result = nl_recvmsgs(wmx->nlh_rx, cb);
d_printf(3, wmx, "I: ctx.result %zd result %zd\n",
ctx.result, result);
- } while ((ctx.result == -EINPROGRESS || ctx.result == -ENODATA)
+ } while ((ctx.result == -EINPROGRESS)
&& result > 0);
if (result < 0)
wimaxll_msg(wmx, "E: %s: nl_recvmgsgs failed: %zd\n",
__func__, result);
- else
+ else if (ctx.result != -EINPROGRESS)
result = ctx.result;
+ else
+ result = 0;
/* No complains on error; the kernel might just be sending an
* error out; pass it through. */
d_fnend(3, wmx, "(wmx %p) = %zd\n", wmx, result);