Skip to content

Commit 4711f91

Browse files
committed
reverts ack
1 parent 930e5ce commit 4711f91

File tree

8 files changed

+11
-72
lines changed

8 files changed

+11
-72
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: nanonext
22
Type: Package
33
Title: NNG (Nanomsg Next Gen) Lightweight Messaging Library
4-
Version: 0.10.2.9022
4+
Version: 0.10.2.9023
55
Description: R binding for NNG (Nanomsg Next Gen), a successor to ZeroMQ. NNG is
66
a socket library implementing 'Scalability Protocols', a reliable,
77
high-performance standard for common communications patterns including

NEWS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# nanonext 0.10.2.9022 (development)
1+
# nanonext 0.10.2.9023 (development)
22

33
#### New Features
44

@@ -10,7 +10,7 @@
1010
* `lock()` supplying 'cv' has improved behaviour which locks the socket whilst allowing for both initial connections and re-connections (when the 'cv' is registered for both add and remove pipe events).
1111
* Improves listener / dialer logic for TLS connections, allowing *inter alia* synchronous dials.
1212
* `pipe_notify()` arguments 'add', 'remove' and 'flag' now default to FALSE instead of TRUE for easier selective specification of the events to signal.
13-
* `request()` argument 'ack' behaviour is more robust.
13+
* `request()` argument 'ack' removed due to stability considerations.
1414
* Fixes memory leaks detected with valgrind.
1515
* Upgrades bundled 'libmbedtls' to v 3.5.0.
1616

R/context.R

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,6 @@ reply <- function(context,
184184
#' @param data an object (if send_mode = 'raw', a vector).
185185
#' @param timeout [default NULL] integer value in milliseconds or NULL, which
186186
#' applies a socket-specific default, usually the same as no timeout.
187-
#' @param ack [default FALSE] logical value whether to send an ack(nowledgement)
188-
#' back to the rep node (consisting of an empty message) when the async
189-
#' receive is complete.
190187
#'
191188
#' @return A 'recvAio' (object of class 'recvAio') (invisibly).
192189
#'
@@ -230,9 +227,8 @@ request <- function(context,
230227
send_mode = c("serial", "raw", "next"),
231228
recv_mode = c("serial", "character", "complex", "double",
232229
"integer", "logical", "numeric", "raw", "string"),
233-
timeout = NULL,
234-
ack = FALSE)
235-
data <- .Call(rnng_request, context, data, send_mode, recv_mode, timeout, ack, environment())
230+
timeout = NULL)
231+
data <- .Call(rnng_request, context, data, send_mode, recv_mode, timeout, environment())
236232

237233
#' Request over Context and Signal a Condition Variable
238234
#'

man/request.Rd

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

src/aio.c

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -244,49 +244,6 @@ static void raio_complete_signal(void *arg) {
244244

245245
}
246246

247-
static void raio_complete_ack(void *arg) {
248-
249-
nano_aio *raio = (nano_aio *) arg;
250-
nng_ctx *ctx = (nng_ctx *) raio->data;
251-
const int res = nng_aio_result(raio->aio);
252-
if (res == 0)
253-
raio->data = nng_aio_get_msg(raio->aio);
254-
255-
#if NNG_MAJOR_VERSION == 1 && NNG_MINOR_VERSION < 6
256-
257-
nng_mtx_lock(shr_mtx);
258-
raio->result = res - !res;
259-
nng_mtx_unlock(shr_mtx);
260-
261-
nng_msg *msg;
262-
if (nng_msg_alloc(&msg, 0) == 0) {
263-
nng_aio *aio;
264-
if (nng_aio_alloc(&aio, NULL, NULL) == 0) {
265-
nng_aio_set_msg(aio, msg);
266-
nng_aio_set_timeout(aio, (nng_duration) NANONEXT_ACK_MS);
267-
nng_ctx_send(*ctx, aio);
268-
nng_aio_wait(aio);
269-
if (nng_aio_result(aio))
270-
nng_msg_free(nng_aio_get_msg(aio));
271-
nng_aio_free(aio);
272-
} else {
273-
nng_msg_free(msg);
274-
}
275-
}
276-
277-
#else
278-
279-
raio->result = res - !res;
280-
nng_msg *msg;
281-
if (nng_msg_alloc(&msg, 0) == 0) {
282-
if (nng_ctx_sendmsg(*ctx, msg, NNG_FLAG_NONBLOCK))
283-
nng_msg_free(msg);
284-
}
285-
286-
#endif
287-
288-
}
289-
290247
static void iraio_complete(void *arg) {
291248

292249
nano_aio *iaio = (nano_aio *) arg;
@@ -1604,15 +1561,14 @@ SEXP rnng_ncurl_session_close(SEXP session) {
16041561

16051562
// request ---------------------------------------------------------------------
16061563

1607-
SEXP rnng_request(SEXP con, SEXP data, SEXP sendmode, SEXP recvmode, SEXP timeout, SEXP ack, SEXP clo) {
1564+
SEXP rnng_request(SEXP con, SEXP data, SEXP sendmode, SEXP recvmode, SEXP timeout, SEXP clo) {
16081565

16091566
if (R_ExternalPtrTag(con) != nano_ContextSymbol)
16101567
Rf_error("'context' is not a valid Context");
16111568

16121569
nng_ctx *ctx = (nng_ctx *) R_ExternalPtrAddr(con);
16131570

16141571
int xc;
1615-
const int ac = LOGICAL(ack)[0];
16161572
const nng_duration dur = timeout == R_NilValue ? NNG_DURATION_DEFAULT : (nng_duration) Rf_asInteger(timeout);
16171573

16181574
SEXP sendaio, aio, env, fun;
@@ -1653,14 +1609,7 @@ SEXP rnng_request(SEXP con, SEXP data, SEXP sendmode, SEXP recvmode, SEXP timeou
16531609
raio->type = RECVAIO;
16541610
raio->mode = nano_matcharg(recvmode);
16551611

1656-
if (ac) {
1657-
raio->data = ctx;
1658-
xc = nng_aio_alloc(&raio->aio, raio_complete_ack, raio);
1659-
} else {
1660-
xc = nng_aio_alloc(&raio->aio, raio_complete, raio);
1661-
}
1662-
1663-
if (xc) {
1612+
if ((xc = nng_aio_alloc(&raio->aio, raio_complete, raio))) {
16641613
R_Free(raio);
16651614
nng_aio_free(saio->aio);
16661615
R_Free(saio);

src/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static const R_CallMethodDef callMethods[] = {
178178
{"rnng_reap", (DL_FUNC) &rnng_reap, 1},
179179
{"rnng_recv", (DL_FUNC) &rnng_recv, 4},
180180
{"rnng_recv_aio", (DL_FUNC) &rnng_recv_aio, 5},
181-
{"rnng_request", (DL_FUNC) &rnng_request, 7},
181+
{"rnng_request", (DL_FUNC) &rnng_request, 6},
182182
{"rnng_send", (DL_FUNC) &rnng_send, 4},
183183
{"rnng_send_aio", (DL_FUNC) &rnng_send_aio, 5},
184184
{"rnng_set_opt", (DL_FUNC) &rnng_set_opt, 3},

src/nanonext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ extern SEXP rnng_random(SEXP, SEXP);
252252
extern SEXP rnng_reap(SEXP);
253253
extern SEXP rnng_recv(SEXP, SEXP, SEXP, SEXP);
254254
extern SEXP rnng_recv_aio(SEXP, SEXP, SEXP, SEXP, SEXP);
255-
extern SEXP rnng_request(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
255+
extern SEXP rnng_request(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
256256
extern SEXP rnng_send(SEXP, SEXP, SEXP, SEXP);
257257
extern SEXP rnng_send_aio(SEXP, SEXP, SEXP, SEXP, SEXP);
258258
extern SEXP rnng_set_opt(SEXP, SEXP, SEXP);

tests/tests.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,9 @@ nanotest(call_aio(cr)$data == "test")
237237
nanotest(is.integer(send(ctxn, TRUE, mode = 0L, block = FALSE)))
238238
nanotest(is.integer(recv(ctxn, mode = 8L, block = FALSE)))
239239
nanotest(typeof(ctxn <- .context(rep)) == "externalptr")
240-
nanotestaio(cs <- request(.context(req$socket), data = TRUE, ack = TRUE))
240+
nanotestaio(cs <- request(.context(req$socket), data = TRUE))
241241
nanotest(recv(ctxn, block = 500))
242242
nanotestz(send(ctxn, TRUE, mode = 3L, block = 500))
243-
nanotest(is.raw(recv(ctxn, mode = 8L, block = 500)))
244243
nanotestz(reap(ctxn))
245244
nanotestz(pipe_notify(rep, cv, add = TRUE, remove = TRUE, flag = TRUE))
246245
nanotestz(pipe_notify(req$socket, cv = cv, add = FALSE, remove = TRUE, flag = FALSE))

0 commit comments

Comments
 (0)