Skip to content

Commit

Permalink
applies patch #1702 to 'libnng' a54820f
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Nov 18, 2023
1 parent 9baf211 commit 0a4a98f
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 18 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: 0.10.4.9002
Version: 0.10.4.9003
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,4 +1,4 @@
# nanonext 0.10.4.9002 (development)
# nanonext 0.10.4.9003 (development)

#### New Features

Expand All @@ -13,6 +13,7 @@
* `until()` updated to be identical to `.until()`, returning FALSE instead of TRUE if the timeout has been reached.
* `pipe_notify()` arguments 'add', 'remove' and 'flag' now default to FALSE instead of TRUE for easier selective specification of the events to signal.
* The weak references interface is removed as 'non-core'.
* Applies fix nanomsg/nng#1702 to bundled 'libnng' v1.6.0 (a54820f).
* Upgrades bundled 'libmbedtls' to v 3.5.1.

# nanonext 0.10.4
Expand Down
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ stat(s, "pipes")

#### Linux / Mac / Solaris

Installation from source requires 'libnng' >= v1.5.0 and 'libmbedtls' >= 2.5.0 (suitable installations are automatically detected), or else 'cmake' to compile 'libnng' v1.6.0 alpha (a54820f) and 'libmbedtls' v3.5.1 included within the package sources.
Installation from source requires 'libnng' >= v1.5.0 and 'libmbedtls' >= 2.5.0 (suitable installations are automatically detected), or else 'cmake' to compile 'libnng' v1.6.0 alpha (a54820f patched) and 'libmbedtls' v3.5.1 included within the package sources.

**It is recommended for optimal performance and stability to let the package automatically compile bundled versions of 'libmbedtls' and 'libnng' during installation.** To always compile the libraries from source even if system installations exist, set the `NANONEXT_LIBS` environment variable prior to installation e.g. by `Sys.setenv(NANONEXT_LIBS = 1)`.

Expand All @@ -710,7 +710,7 @@ It is neither necessary nor recommended to install system libraries, but 'libnng

#### Windows

For R >= 4.2 using the 'Rtools42' or 'Rtools43' toolchains, 'libnng' v1.6.0 alpha (a54820f) and 'libmbedtls' v3.5.1 will be automatically compiled from the package sources during installation.
For R >= 4.2 using the 'Rtools42' or 'Rtools43' toolchains, 'libnng' v1.6.0 alpha (a54820f patched) and 'libmbedtls' v3.5.1 will be automatically compiled from the package sources during installation.

For previous R versions, pre-compiled 'libnng' v1.6.0 alpha (a54820f) and 'libmbedtls' v3.5.1 libraries are downloaded and used for installation instead.

Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ aio
#> < recvAio >
#> - $data for message data
aio$data |> str()
#> num [1:100000000] 0.0868 -0.517 -0.0641 0.52 -0.7696 ...
#> num [1:100000000] -0.4016 -1.1204 0.0317 -0.1929 -0.4284 ...
```

As `call_aio()` is blocking and will wait for completion, an alternative
Expand Down Expand Up @@ -536,7 +536,7 @@ throughout, or alternatively ‘localhost’, but not a mixture of the two.
cert <- write_cert(cn = "127.0.0.1")
str(cert)
#> List of 2
#> $ server: chr [1:2] "-----BEGIN CERTIFICATE-----\nMIIFOTCCAyGgAwIBAgIBATANBgkqhkiG9w0BAQsFADA0MRIwEAYDVQQDDAkxMjcu\nMC4wLjExETAPBgNV"| __truncated__ "-----BEGIN RSA PRIVATE KEY-----\nMIIJKAIBAAKCAgEArgrnwRvqfzkNXwrHYr4gAy1iYjKXVti8toT/ApCcxTsi0RaX\n2I3arHfx/gLp"| __truncated__
#> $ server: chr [1:2] "-----BEGIN CERTIFICATE-----\nMIIFOTCCAyGgAwIBAgIBATANBgkqhkiG9w0BAQsFADA0MRIwEAYDVQQDDAkxMjcu\nMC4wLjExETAPBgNV"| __truncated__ "-----BEGIN RSA PRIVATE KEY-----\nMIIJKAIBAAKCAgEAki3ZU+tHR5YHDm5tt20RNITY0Mg7hnez0arQzuaDn3JG4rl3\n1zgO4O0a/jzv"| __truncated__
#> $ client: chr [1:2] "-----BEGIN CERTIFICATE-----\nMIIFOTCCAyGgAwIBAgIBATANBgkqhkiG9w0BAQsFADA0MRIwEAYDVQQDDAkxMjcu\nMC4wLjExETAPBgNV"| __truncated__ ""

ser <- tls_config(server = cert$server)
Expand Down Expand Up @@ -705,7 +705,7 @@ ncurl("https://postman-echo.com/get")
#> NULL
#>
#> $data
#> [1] "{\n \"args\": {},\n \"headers\": {\n \"x-forwarded-proto\": \"https\",\n \"x-forwarded-port\": \"443\",\n \"host\": \"postman-echo.com\",\n \"x-amzn-trace-id\": \"Root=1-654e05a6-7c3ebbf9568555c65c2a83f9\"\n },\n \"url\": \"https://postman-echo.com/get\"\n}"
#> [1] "{\n \"args\": {},\n \"headers\": {\n \"x-forwarded-proto\": \"https\",\n \"x-forwarded-port\": \"443\",\n \"host\": \"postman-echo.com\",\n \"x-amzn-trace-id\": \"Root=1-65593e08-1063be555f206acc33ebb9d9\"\n },\n \"url\": \"https://postman-echo.com/get\"\n}"
```

For advanced use, supports additional HTTP methods such as POST or PUT.
Expand All @@ -724,10 +724,10 @@ res

call_aio(res)$headers
#> $date
#> [1] "Fri, 10 Nov 2023 10:27:50 GMT"
#> [1] "Sat, 18 Nov 2023 22:43:21 GMT"

res$data
#> [1] "{\n \"args\": {},\n \"data\": {\n \"key\": \"value\"\n },\n \"files\": {},\n \"form\": {},\n \"headers\": {\n \"x-forwarded-proto\": \"https\",\n \"x-forwarded-port\": \"443\",\n \"host\": \"postman-echo.com\",\n \"x-amzn-trace-id\": \"Root=1-654e05a6-5bfa3eda71522a2143ae7113\",\n \"content-length\": \"16\",\n \"content-type\": \"application/json\",\n \"authorization\": \"Bearer APIKEY\"\n },\n \"json\": {\n \"key\": \"value\"\n },\n \"url\": \"https://postman-echo.com/post\"\n}"
#> [1] "{\n \"args\": {},\n \"data\": {\n \"key\": \"value\"\n },\n \"files\": {},\n \"form\": {},\n \"headers\": {\n \"x-forwarded-proto\": \"https\",\n \"x-forwarded-port\": \"443\",\n \"host\": \"postman-echo.com\",\n \"x-amzn-trace-id\": \"Root=1-65593e09-466c82e6480fd83a25abb62a\",\n \"content-length\": \"16\",\n \"content-type\": \"application/json\",\n \"authorization\": \"Bearer APIKEY\"\n },\n \"json\": {\n \"key\": \"value\"\n },\n \"url\": \"https://postman-echo.com/post\"\n}"
```

In this respect, it may be used as a performant and lightweight method
Expand Down Expand Up @@ -758,7 +758,7 @@ transact(sess)
#>
#> $headers
#> $headers$Date
#> [1] "Fri, 10 Nov 2023 10:27:51 GMT"
#> [1] "Sat, 18 Nov 2023 22:43:21 GMT"
#>
#> $headers$`Content-Type`
#> [1] "application/json; charset=utf-8"
Expand All @@ -771,8 +771,8 @@ transact(sess)
#> [76] 77 61 72 64 65 64 2d 70 6f 72 74 22 3a 20 22 34 34 33 22 2c 0a 20 20 20 20
#> [101] 22 68 6f 73 74 22 3a 20 22 70 6f 73 74 6d 61 6e 2d 65 63 68 6f 2e 63 6f 6d
#> [126] 22 2c 0a 20 20 20 20 22 78 2d 61 6d 7a 6e 2d 74 72 61 63 65 2d 69 64 22 3a
#> [151] 20 22 52 6f 6f 74 3d 31 2d 36 35 34 65 30 35 61 37 2d 35 63 36 33 64 34 61
#> [176] 64 33 31 63 38 62 63 66 61 31 62 38 30 31 32 34 36 22 2c 0a 20 20 20 20 22
#> [151] 20 22 52 6f 6f 74 3d 31 2d 36 35 35 39 33 65 30 39 2d 30 31 38 63 30 61 31
#> [176] 66 36 30 34 61 32 66 64 66 31 30 37 66 65 33 61 34 22 2c 0a 20 20 20 20 22
#> [201] 63 6f 6e 74 65 6e 74 2d 74 79 70 65 22 3a 20 22 61 70 70 6c 69 63 61 74 69
#> [226] 6f 6e 2f 6a 73 6f 6e 22 2c 0a 20 20 20 20 22 61 75 74 68 6f 72 69 7a 61 74
#> [251] 69 6f 6e 22 3a 20 22 42 65 61 72 65 72 20 41 50 49 4b 45 59 22 0a 20 20 7d
Expand Down Expand Up @@ -936,8 +936,8 @@ stat(s, "pipes")

Installation from source requires ‘libnng’ \>= v1.5.0 and ‘libmbedtls’
\>= 2.5.0 (suitable installations are automatically detected), or else
‘cmake’ to compile ‘libnng’ v1.6.0 alpha (a54820f) and ‘libmbedtls’
v3.5.1 included within the package sources.
‘cmake’ to compile ‘libnng’ v1.6.0 alpha (a54820f patched) and
‘libmbedtls’ v3.5.1 included within the package sources.

**It is recommended for optimal performance and stability to let the
package automatically compile bundled versions of ‘libmbedtls’ and
Expand All @@ -960,8 +960,8 @@ OpenCSW - refer to the ‘cmake’ website for the latest source file.*
#### Windows

For R \>= 4.2 using the ‘Rtools42’ or ‘Rtools43’ toolchains, ‘libnng’
v1.6.0 alpha (a54820f) and ‘libmbedtls’ v3.5.1 will be automatically
compiled from the package sources during installation.
v1.6.0 alpha (a54820f patched) and ‘libmbedtls’ v3.5.1 will be
automatically compiled from the package sources during installation.

For previous R versions, pre-compiled ‘libnng’ v1.6.0 alpha (a54820f)
and ‘libmbedtls’ v3.5.1 libraries are downloaded and used for
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

# Library versions
LIB_VER="a54820f"
LIB_VER="a54820f-1702"
TLS_VER="edb8fec"

# Initialise
Expand Down
2 changes: 1 addition & 1 deletion configure.ucrt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Library versions
LIB_VER="a54820f"
LIB_VER="a54820f-1702"
TLS_VER="edb8fec"

tar -xf src/mbedtls-$TLS_VER.tar.xz
Expand Down
6 changes: 6 additions & 0 deletions src/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,10 @@ static void reqsaio_finalizer(SEXP xptr) {
if (R_ExternalPtrAddr(xptr) == NULL)
return;
nano_aio *xp = (nano_aio *) R_ExternalPtrAddr(xptr);
#if NNG_MAJOR_VERSION == 1 && NNG_MINOR_VERSION < 6
nng_ctx *ctx = (nng_ctx *) xp->data;
nng_ctx_close(*ctx);
#endif
nng_aio_free(xp->aio);
R_Free(xp);

Expand Down Expand Up @@ -1579,7 +1581,9 @@ SEXP rnng_request(SEXP con, SEXP data, SEXP sendmode, SEXP recvmode, SEXP timeou
}

nano_aio *saio = R_Calloc(1, nano_aio);
#if NNG_MAJOR_VERSION == 1 && NNG_MINOR_VERSION < 6
saio->data = ctx;
#endif

if ((xc = nng_msg_alloc(&msg, 0))) {
R_Free(saio);
Expand Down Expand Up @@ -1903,7 +1907,9 @@ SEXP rnng_cv_request(SEXP con, SEXP data, SEXP cvar, SEXP sendmode, SEXP recvmod
}

nano_aio *saio = R_Calloc(1, nano_aio);
#if NNG_MAJOR_VERSION == 1 && NNG_MINOR_VERSION < 6
saio->data = ctx;
#endif

if ((xc = nng_msg_alloc(&msg, 0))) {
R_Free(saio);
Expand Down
Binary file added src/nng-a54820f-1702.tar.xz
Binary file not shown.
Binary file removed src/nng-a54820f.tar.xz
Binary file not shown.

0 comments on commit 0a4a98f

Please sign in to comment.