Skip to content

Commit

Permalink
pipe close concept
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Jan 8, 2025
1 parent a15e9e3 commit 0ebcdf2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: nanonext
Type: Package
Title: NNG (Nanomsg Next Gen) Lightweight Messaging Library
Version: 1.4.0.9000
Version: 1.4.0.9001
Description: R binding for NNG (Nanomsg Next Gen), a successor to ZeroMQ. NNG is
a socket library implementing 'Scalability Protocols', a reliable,
high-performance standard for common communications patterns including
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# nanonext 1.4.0.9000 (development)
# nanonext 1.4.0.9001 (development)

#### Updates

* `reap()` now accepts an integer pipe ID to close the associated pipe.
* Removes partial matching from using `$`, `[[` or `[` on an object inheriting from class 'nano'.

# nanonext 1.4.0
Expand Down
2 changes: 1 addition & 1 deletion R/messenger.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ messenger <- function(url, auth = NULL) {
sock <- .Call(rnng_messenger, url)
on.exit(expr = {
send(sock, data = writeBin(":d ", raw()), mode = 2L, block = FALSE)
.Call(rnng_close, sock)
close(sock)
})
cat("\n", file = stdout())
intro <- unlist(strsplit("nanonext messenger", ""))
Expand Down
2 changes: 1 addition & 1 deletion R/socket.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ close.nanoSocket <- function(con, ...) invisible(.Call(rnng_close, con))
#' \code{\link{.context}}. Returns silently and does not warn or error, nor does
#' it update the state of object attributes.
#'
#' @param con a Socket, Context, Listener, Dialer or Pipe.
#' @param con a Socket, Context, Listener, Dialer or integer pipe ID.
#'
#' @return An integer exit code (zero on success).
#'
Expand Down
2 changes: 1 addition & 1 deletion man/reap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ SEXP rnng_reap(SEXP con) {
} else if (ptrtag == nano_DialerSymbol) {
xc = nng_dialer_close(*(nng_dialer *) NANO_PTR(con));

} else if (TYPEOF(con) == INTSXP) {
nng_pipe p;
p.id = (uint32_t) NANO_INTEGER(con);
xc = nng_pipe_close(p);

} else {
xc = 3;
}
Expand Down

0 comments on commit 0ebcdf2

Please sign in to comment.