@zlink-systems/zlink 0.17.5 → 0.17.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,6 +14,7 @@ exports.closeCall = closeCall;
|
|
|
14
14
|
exports.recvNativeError = recvNativeError;
|
|
15
15
|
exports.submitNativeError = submitNativeError;
|
|
16
16
|
exports.submitOrBackpressure = submitOrBackpressure;
|
|
17
|
+
const node_os_1 = require("node:os");
|
|
17
18
|
const native_1 = require("../native/native");
|
|
18
19
|
const socket_constants_1 = require("../../contracts/sockets/socket_constants");
|
|
19
20
|
const errors_1 = require("../../contracts/errors/errors");
|
|
@@ -24,7 +25,7 @@ function readErrno() {
|
|
|
24
25
|
return typeof native.errno === 'function' ? native.errno() : 0;
|
|
25
26
|
}
|
|
26
27
|
function isWouldBlock(errno = readErrno()) {
|
|
27
|
-
return errno ===
|
|
28
|
+
return errno === node_os_1.constants.errno.EAGAIN;
|
|
28
29
|
}
|
|
29
30
|
function nativeErrorMessage(error, fallbackMessage) {
|
|
30
31
|
return error instanceof Error && error.message ? error.message : fallbackMessage;
|
package/native/src/addon_core.cc
CHANGED
|
@@ -45,7 +45,7 @@ class small_msg_storage_t
|
|
|
45
45
|
stack_size_ = count;
|
|
46
46
|
return true;
|
|
47
47
|
}
|
|
48
|
-
if (count > std::numeric_limits<size_t>::max () / sizeof (zlink_msg_t)) {
|
|
48
|
+
if (count > (std::numeric_limits<size_t>::max) () / sizeof (zlink_msg_t)) {
|
|
49
49
|
napi_throw_error (env, NULL, "message parts allocation failed");
|
|
50
50
|
return false;
|
|
51
51
|
}
|
|
@@ -106,9 +106,9 @@ class small_msg_storage_t
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
if (heap_size_ == heap_capacity_) {
|
|
109
|
-
if (heap_capacity_ > std::numeric_limits<size_t>::max () / 2
|
|
109
|
+
if (heap_capacity_ > (std::numeric_limits<size_t>::max) () / 2
|
|
110
110
|
|| heap_capacity_ * 2
|
|
111
|
-
> std::numeric_limits<size_t>::max () / sizeof (zlink_msg_t))
|
|
111
|
+
> (std::numeric_limits<size_t>::max) () / sizeof (zlink_msg_t))
|
|
112
112
|
return false;
|
|
113
113
|
const size_t capacity = heap_capacity_ * 2;
|
|
114
114
|
std::unique_ptr<zlink_msg_t[]> candidate (
|