Skip to content

Commit 72612e5

Browse files
committed
fix until()
1 parent b58294e commit 72612e5

File tree

4 files changed

+22
-18
lines changed

4 files changed

+22
-18
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.8.1.9027
4+
Version: 0.8.1.9028
55
Description: R binding for NNG (Nanomsg Next Gen), a successor to ZeroMQ. NNG is
66
a socket library providing high-performance scalability protocols, a
77
cross-platform standard for messaging and communications. Serves as a

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# nanonext 0.8.1.9027
1+
# nanonext 0.8.1.9028
22

33
#### New Features
44

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ aio
368368
#> < recvAio >
369369
#> - $data for message data
370370
aio$data |> str()
371-
#> num [1:100000000] 0.21 0.012 -1.352 2.168 3.019 ...
371+
#> num [1:100000000] 0.196 -1.443 0.464 0.223 1.442 ...
372372
```
373373

374374
As `call_aio()` is blocking and will wait for completion, an alternative
@@ -654,11 +654,11 @@ ncurl("https://httpbin.org/headers")
654654
#> [1] 7b 0a 20 20 22 68 65 61 64 65 72 73 22 3a 20 7b 0a 20 20 20 20 22 48 6f 73
655655
#> [26] 74 22 3a 20 22 68 74 74 70 62 69 6e 2e 6f 72 67 22 2c 20 0a 20 20 20 20 22
656656
#> [51] 58 2d 41 6d 7a 6e 2d 54 72 61 63 65 2d 49 64 22 3a 20 22 52 6f 6f 74 3d 31
657-
#> [76] 2d 36 34 33 35 34 38 39 65 2d 30 38 64 39 62 33 62 30 34 62 35 32 64 64 63
658-
#> [101] 33 35 62 36 33 39 64 34 61 22 0a 20 20 7d 0a 7d 0a
657+
#> [76] 2d 36 34 33 39 36 39 61 36 2d 31 62 30 39 36 38 33 64 32 33 34 35 31 62 63
658+
#> [101] 66 37 31 63 37 33 39 31 38 22 0a 20 20 7d 0a 7d 0a
659659
#>
660660
#> $data
661-
#> [1] "{\n \"headers\": {\n \"Host\": \"httpbin.org\", \n \"X-Amzn-Trace-Id\": \"Root=1-6435489e-08d9b3b04b52ddc35b639d4a\"\n }\n}\n"
661+
#> [1] "{\n \"headers\": {\n \"Host\": \"httpbin.org\", \n \"X-Amzn-Trace-Id\": \"Root=1-643969a6-1b09683d23451bcf71c73918\"\n }\n}\n"
662662
```
663663

664664
For advanced use, supports additional HTTP methods such as POST or PUT.
@@ -679,13 +679,13 @@ res
679679

680680
call_aio(res)$headers
681681
#> $Date
682-
#> [1] "Tue, 11 Apr 2023 11:46:39 GMT"
682+
#> [1] "Fri, 14 Apr 2023 14:57:08 GMT"
683683
#>
684684
#> $Server
685685
#> [1] "gunicorn/19.9.0"
686686

687687
res$data
688-
#> [1] "{\n \"args\": {}, \n \"data\": \"{\\\"key\\\": \\\"value\\\"}\", \n \"files\": {}, \n \"form\": {}, \n \"headers\": {\n \"Authorization\": \"Bearer APIKEY\", \n \"Content-Length\": \"16\", \n \"Content-Type\": \"application/json\", \n \"Host\": \"httpbin.org\", \n \"X-Amzn-Trace-Id\": \"Root=1-6435489e-170ad28a68da8ee85b7f1cbb\"\n }, \n \"json\": {\n \"key\": \"value\"\n }, \n \"origin\": \"131.111.5.14\", \n \"url\": \"http://httpbin.org/post\"\n}\n"
688+
#> [1] "{\n \"args\": {}, \n \"data\": \"{\\\"key\\\": \\\"value\\\"}\", \n \"files\": {}, \n \"form\": {}, \n \"headers\": {\n \"Authorization\": \"Bearer APIKEY\", \n \"Content-Length\": \"16\", \n \"Content-Type\": \"application/json\", \n \"Host\": \"httpbin.org\", \n \"X-Amzn-Trace-Id\": \"Root=1-643969c1-76e205a6192b089d75afa6cd\"\n }, \n \"json\": {\n \"key\": \"value\"\n }, \n \"origin\": \"131.111.5.14\", \n \"url\": \"http://httpbin.org/post\"\n}\n"
689689
```
690690

691691
In this respect, it may be used as a performant and lightweight method
@@ -711,7 +711,7 @@ transact(sess)
711711
#>
712712
#> $headers
713713
#> $headers$date
714-
#> [1] "Tue, 11 Apr 2023 11:46:40 GMT"
714+
#> [1] "Fri, 14 Apr 2023 14:57:32 GMT"
715715
#>
716716
#>
717717
#> $raw
@@ -721,15 +721,15 @@ transact(sess)
721721
#> [76] 22 43 6f 6e 74 65 6e 74 2d 54 79 70 65 22 3a 20 22 61 70 70 6c 69 63 61 74
722722
#> [101] 69 6f 6e 2f 6a 73 6f 6e 22 2c 20 0a 20 20 20 20 22 48 6f 73 74 22 3a 20 22
723723
#> [126] 68 74 74 70 62 69 6e 2e 6f 72 67 22 2c 20 0a 20 20 20 20 22 58 2d 41 6d 7a
724-
#> [151] 6e 2d 54 72 61 63 65 2d 49 64 22 3a 20 22 52 6f 6f 74 3d 31 2d 36 34 33 35
725-
#> [176] 34 38 39 66 2d 34 33 62 38 35 64 65 38 35 32 65 64 34 35 37 65 31 34 35 62
726-
#> [201] 62 37 62 61 22 0a 20 20 7d 2c 20 0a 20 20 22 6f 72 69 67 69 6e 22 3a 20 22
727-
#> [226] 37 39 2e 31 37 33 2e 31 32 39 2e 32 22 2c 20 0a 20 20 22 75 72 6c 22 3a 20
728-
#> [251] 22 68 74 74 70 73 3a 2f 2f 68 74 74 70 62 69 6e 2e 6f 72 67 2f 67 65 74 22
729-
#> [276] 0a 7d 0a
724+
#> [151] 6e 2d 54 72 61 63 65 2d 49 64 22 3a 20 22 52 6f 6f 74 3d 31 2d 36 34 33 39
725+
#> [176] 36 39 63 35 2d 33 30 66 36 35 64 35 39 36 35 62 65 66 30 36 32 37 62 62 66
726+
#> [201] 65 63 66 31 22 0a 20 20 7d 2c 20 0a 20 20 22 6f 72 69 67 69 6e 22 3a 20 22
727+
#> [226] 33 31 2e 39 34 2e 37 2e 31 31 38 22 2c 20 0a 20 20 22 75 72 6c 22 3a 20 22
728+
#> [251] 68 74 74 70 73 3a 2f 2f 68 74 74 70 62 69 6e 2e 6f 72 67 2f 67 65 74 22 0a
729+
#> [276] 7d 0a
730730
#>
731731
#> $data
732-
#> [1] "{\n \"args\": {}, \n \"headers\": {\n \"Authorization\": \"Bearer APIKEY\", \n \"Content-Type\": \"application/json\", \n \"Host\": \"httpbin.org\", \n \"X-Amzn-Trace-Id\": \"Root=1-6435489f-43b85de852ed457e145bb7ba\"\n }, \n \"origin\": \"131.111.5.14\", \n \"url\": \"https://httpbin.org/get\"\n}\n"
732+
#> [1] "{\n \"args\": {}, \n \"headers\": {\n \"Authorization\": \"Bearer APIKEY\", \n \"Content-Type\": \"application/json\", \n \"Host\": \"httpbin.org\", \n \"X-Amzn-Trace-Id\": \"Root=1-643969c5-30f65d5965bef0627bbfecf1\"\n }, \n \"origin\": \"131.111.5.14\", \n \"url\": \"https://httpbin.org/get\"\n}\n"
733733
```
734734

735735
[« Back to ToC](#table-of-contents)

src/aio.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,11 +1408,15 @@ SEXP rnng_cv_until(SEXP cvar, SEXP msec) {
14081408
break;
14091409
}
14101410

1411+
uint8_t success = 1;
14111412
nng_mtx_lock(mtx);
14121413
while (ncv->condition == 0) {
1413-
if (nng_cv_until(cv, time) == NNG_ETIMEDOUT) break;
1414+
if (nng_cv_until(cv, time) == NNG_ETIMEDOUT) {
1415+
success = 0;
1416+
break;
1417+
}
14141418
}
1415-
if (ncv->condition > 0) ncv->condition--;
1419+
if (success) ncv->condition--;
14161420
nng_mtx_unlock(mtx);
14171421

14181422
return ncv->flag ? Rf_ScalarLogical(0) : Rf_ScalarLogical(1);

0 commit comments

Comments
 (0)