Skip to content

Commit

Permalink
(WIP) Add udx packetsDroppedByKernel (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
HDegroote authored Dec 9, 2024
1 parent 05007fd commit d216925
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions binding.c
Original file line number Diff line number Diff line change
Expand Up @@ -1788,6 +1788,10 @@ napi_macros_init (napi_env env, napi_value exports) {
napi_create_uint32(env, offsetof(udx_t, packets_tx), &udx_packets_tx_offsetof);
napi_set_named_property(env, exports, "offsetof_udx_t_packets_tx", udx_packets_tx_offsetof);

napi_value udx_packets_dropped_by_kernel_offsetof;
napi_create_uint32(env, offsetof(udx_t, packets_dropped_by_kernel), &udx_packets_dropped_by_kernel_offsetof);
napi_set_named_property(env, exports, "offsetof_udx_t_packets_dropped_by_kernel", udx_packets_dropped_by_kernel_offsetof);

napi_value udx_napi_t_sizeof;
napi_create_uint32(env, sizeof(udx_napi_t), &udx_napi_t_sizeof);
napi_set_named_property(env, exports, "sizeof_udx_napi_t", udx_napi_t_sizeof);
Expand Down
4 changes: 4 additions & 0 deletions lib/udx.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ module.exports = class UDX {
return Number(this._view64[binding.offsetof_udx_t_packets_rx >> 3])
}

get packetsDroppedByKernel () {
return Number(this._view64[binding.offsetof_udx_t_packets_dropped_by_kernel >> 3])
}

_consumeMessage (len) {
const next = this._buffer.subarray(0, len)
this._buffer = this._buffer.subarray(len)
Expand Down

0 comments on commit d216925

Please sign in to comment.