Skip to content

Commit 2d9c928

Browse files
committed
minor cleanups to previous commit
1 parent c7f3cf4 commit 2d9c928

File tree

8 files changed

+20
-14
lines changed

8 files changed

+20
-14
lines changed

R/context.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ ctx_recv <- function(context,
174174
#' perfect reproducibility. Use 'raw' for sending vectors of any type (will be
175175
#' converted to a raw byte vector for sending) - essential when interfacing
176176
#' with external applications.
177-
#' @param recv_mode [default 'serial'] mode of vector to be read - one of 'serial',
177+
#' @param recv_mode [default 'serial'] mode of vector to be received - one of 'serial',
178178
#' 'character', 'complex', 'double', 'integer', 'logical', 'numeric', or 'raw'.
179179
#' The default 'serial' means a serialised R object, for the other modes,
180180
#' the raw vector received will be converted into the respective mode.
@@ -185,7 +185,7 @@ ctx_recv <- function(context,
185185
#' be used. Note this applies to each of the receive and send legs, hence the
186186
#' total elapsed time could be up to twice this parameter plus the time to
187187
#' perform 'execute' on the received data.
188-
#' @param ... additional arguments passed to the function specified in 'reply'.
188+
#' @param ... additional arguments passed to the function specified by 'execute'.
189189
#'
190190
#' @return Invisible NULL.
191191
#'
@@ -251,7 +251,7 @@ ctx_rep <- function(context,
251251
#'
252252
#' @inheritParams ctx_rep
253253
#' @inheritParams ctx_recv
254-
#' @param data an R object (if mode is not 'serial', an R vector).
254+
#' @param data an R object (if send_mode = 'raw', an R vector).
255255
#' @param timeout in ms. If unspecified, a socket-specific default timeout will
256256
#' be used. Note this applies to each of the send and receive legs, hence the
257257
#' total elapsed time could be up to twice this parameter.

R/sendrecv.R

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ send <- function(socket, data, mode = c("serial", "raw"), block = FALSE, echo =
3636
serial = serialize(object = data, connection = NULL),
3737
raw = if (is.raw(data)) data else writeBin(object = data, con = raw()))
3838
res <- .Call(rnng_send, socket, data, block)
39-
if (is.integer(res)) message(res, " : ", nng_error(res))
39+
is.integer(res) && {
40+
message(res, " : ", nng_error(res))
41+
return(invisible(res))
42+
}
4043
if (missing(echo) || isTRUE(echo)) res else invisible(0L)
4144

4245
}
@@ -94,7 +97,7 @@ send_aio <- function(socket, ..., mode = c("serial", "raw"), timeout) {
9497
#' Receive data over a Socket.
9598
#'
9699
#' @param socket a Socket.
97-
#' @param mode [default 'serial'] mode of vector to be read - one of 'serial',
100+
#' @param mode [default 'serial'] mode of vector to be received - one of 'serial',
98101
#' 'character', 'complex', 'double', 'integer', 'logical', 'numeric', or 'raw'.
99102
#' The default 'serial' means a serialised R object, for the other modes,
100103
#' the raw vector received will be converted into the respective mode.
@@ -248,7 +251,10 @@ send_vec <- function(socket, data, block = FALSE, echo = TRUE) {
248251

249252
data <- if (is.raw(data)) data else writeBin(object = data, con = raw())
250253
res <- .Call(rnng_send, socket, data, block)
251-
if (is.integer(res)) message(res, " : ", nng_error(res))
254+
is.integer(res) && {
255+
message(res, " : ", nng_error(res))
256+
return(invisible(res))
257+
}
252258
if (missing(echo) || isTRUE(echo)) res else invisible()
253259

254260
}

man/ctx_recv.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/ctx_recv_vec.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/ctx_rep.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/ctx_req.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/recv.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/recv_aio.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)