From fab88b005101b4fe79dc906145b07f64bb98c6aa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 14 Oct 2026 06:25:48 +0000 Subject: [PATCH] Version Packages --- .changeset/auto-unbind-response.md | 10 ------ .changeset/listener-exceptions.md | 26 -------------- .changeset/outgoing-event.md | 16 --------- .changeset/session-addresses.md | 11 ------ CHANGELOG.md | 54 ++++++++++++++++++++++++++++++ package.json | 2 +- 6 files changed, 55 insertions(+), 64 deletions(-) delete mode 100644 .changeset/auto-unbind-response.md delete mode 100644 .changeset/listener-exceptions.md delete mode 100644 .changeset/outgoing-event.md delete mode 100644 .changeset/session-addresses.md diff --git a/.changeset/auto-unbind-response.md b/.changeset/auto-unbind-response.md deleted file mode 100644 index bd4c3e3..0000000 --- a/.changeset/auto-unbind-response.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -'@semyonf/smpp': minor ---- - -Add an `auto_unbind_response` option to `connect()` and `createServer()` (default `false`): the -session answers an incoming `unbind` with an `unbind_resp` of status `ESME_ROK`, stops its -`enquire_link` schedule and closes the connection (destroying the socket once the `unbind_resp` has -been flushed, so `'close'` follows even if the peer never closes its side), before emitting the -`'pdu'` and `'unbind'` events. Can be changed at runtime through `session.autoUnbindResponse`. It is -off by default so that handlers which already answer `unbind` keep working as they are. diff --git a/.changeset/listener-exceptions.md b/.changeset/listener-exceptions.md deleted file mode 100644 index ba289fd..0000000 --- a/.changeset/listener-exceptions.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -'@semyonf/smpp': minor ---- - -Fix a session silently going deaf after one of its listeners threw, and add a `'listener_error'` -event. - -An exception thrown by a `'pdu'` or command listener, or by a `responseCallback`, unwound the read -loop with its busy flag still set, after which every further `'readable'` event was ignored and the -session stopped reading the socket for good (an `enquire_link_timeout` would destroy it, nothing -resumed it). An exception in a `'debug'`/`'metrics'` listener or `debugListener` did the same, and -during `pdu.command.in` was reported as an `'error'` of the session as if the stream were corrupt. A -throwing `'send'` listener skipped the `sendCallback`, a throwing `failureCallback` during `'close'` -skipped the other pending requests and the `'close'` event itself, and a throwing -`'response_timeout'` listener skipped the request's `failureCallback`. - -Every listener and callback the session calls is now isolated: the exception is emitted as a -`'listener_error'` event with `{ error, event, pdu }` (type `ListenerErrorReport`), and rethrown on -the next tick when nothing listens for it, so it still surfaces as an uncaught exception, but no -longer from inside `send()`/`resume()`, and only after the rest of the chunk has been handled. The -`'error'` event without a listener is rethrown the same way instead of throwing synchronously out of -the socket handler, where it left the stream stuck. - -A pdu that cannot be parsed (bad length, truncated body) now destroys the connection after the -`'error'` event, as the README always said. Until now the session kept the socket open but never -read it again. diff --git a/.changeset/outgoing-event.md b/.changeset/outgoing-event.md deleted file mode 100644 index 313513b..0000000 --- a/.changeset/outgoing-event.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -'@semyonf/smpp': minor ---- - -Add an `'outgoing'` event, emitted synchronously from `session.send()` for every pdu handed to the -socket: requests and responses, including the automatic `enquire_link`, `enquire_link_resp` and -`unbind_resp`. - -The `'send'` event is emitted from the write callback, and Node does not guarantee that it runs -before the response is read, so the response to a request could be emitted as `'pdu'` before the -request's own `'send'`. `'outgoing'` is emitted once the `sequence_number` is assigned, right after -`socket.write()` was called, so for a request it always comes before the `'pdu'` event of its -response. It is not emitted when `send()` returns `false` or throws. - -Also, a pdu that cannot be encoded no longer leaves a pending request behind: `send()` still throws, -but nothing waits for a response that was never asked for. diff --git a/.changeset/session-addresses.md b/.changeset/session-addresses.md deleted file mode 100644 index 6cb281d..0000000 --- a/.changeset/session-addresses.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -'@semyonf/smpp': minor ---- - -Add `session.localAddress` and `session.localPort`, set together with `remoteAddress`/`remotePort` -(on connect for a client session, on creation for a server session, always from the socket that -carries the TCP connection) and, like them, kept after the connection has closed, when the socket -itself has forgotten its local address. On a proxy-protocol session `remoteAddress`/`remotePort` -still come from the PROXY header, while the local address is that of the TCP connection from the -proxy. Also fixes the client `'connect'` handler, which fell back to `remoteAddress` instead of the -previous `remotePort` when the socket reported no peer port. diff --git a/CHANGELOG.md b/CHANGELOG.md index 9abc49f..0fdb63d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,59 @@ # @semyonf/smpp +## 1.8.0 + +### Minor Changes + +- bf9cefd: Add an `auto_unbind_response` option to `connect()` and `createServer()` (default `false`): the + session answers an incoming `unbind` with an `unbind_resp` of status `ESME_ROK`, stops its + `enquire_link` schedule and closes the connection (destroying the socket once the `unbind_resp` has + been flushed, so `'close'` follows even if the peer never closes its side), before emitting the + `'pdu'` and `'unbind'` events. Can be changed at runtime through `session.autoUnbindResponse`. It is + off by default so that handlers which already answer `unbind` keep working as they are. +- bf9cefd: Fix a session silently going deaf after one of its listeners threw, and add a `'listener_error'` + event. + + An exception thrown by a `'pdu'` or command listener, or by a `responseCallback`, unwound the read + loop with its busy flag still set, after which every further `'readable'` event was ignored and the + session stopped reading the socket for good (an `enquire_link_timeout` would destroy it, nothing + resumed it). An exception in a `'debug'`/`'metrics'` listener or `debugListener` did the same, and + during `pdu.command.in` was reported as an `'error'` of the session as if the stream were corrupt. A + throwing `'send'` listener skipped the `sendCallback`, a throwing `failureCallback` during `'close'` + skipped the other pending requests and the `'close'` event itself, and a throwing + `'response_timeout'` listener skipped the request's `failureCallback`. + + Every listener and callback the session calls is now isolated: the exception is emitted as a + `'listener_error'` event with `{ error, event, pdu }` (type `ListenerErrorReport`), and rethrown on + the next tick when nothing listens for it, so it still surfaces as an uncaught exception, but no + longer from inside `send()`/`resume()`, and only after the rest of the chunk has been handled. The + `'error'` event without a listener is rethrown the same way instead of throwing synchronously out of + the socket handler, where it left the stream stuck. + + A pdu that cannot be parsed (bad length, truncated body) now destroys the connection after the + `'error'` event, as the README always said. Until now the session kept the socket open but never + read it again. + +- bf9cefd: Add an `'outgoing'` event, emitted synchronously from `session.send()` for every pdu handed to the + socket: requests and responses, including the automatic `enquire_link`, `enquire_link_resp` and + `unbind_resp`. + + The `'send'` event is emitted from the write callback, and Node does not guarantee that it runs + before the response is read, so the response to a request could be emitted as `'pdu'` before the + request's own `'send'`. `'outgoing'` is emitted once the `sequence_number` is assigned, right after + `socket.write()` was called, so for a request it always comes before the `'pdu'` event of its + response. It is not emitted when `send()` returns `false` or throws. + + Also, a pdu that cannot be encoded no longer leaves a pending request behind: `send()` still throws, + but nothing waits for a response that was never asked for. + +- bf9cefd: Add `session.localAddress` and `session.localPort`, set together with `remoteAddress`/`remotePort` + (on connect for a client session, on creation for a server session, always from the socket that + carries the TCP connection) and, like them, kept after the connection has closed, when the socket + itself has forgotten its local address. On a proxy-protocol session `remoteAddress`/`remotePort` + still come from the PROXY header, while the local address is that of the TCP connection from the + proxy. Also fixes the client `'connect'` handler, which fell back to `remoteAddress` instead of the + previous `remotePort` when the socket reported no peer port. + ## 1.7.1 ### Patch Changes diff --git a/package.json b/package.json index 8ed6f1b..5fcf89e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@semyonf/smpp", - "version": "1.7.1", + "version": "1.8.0", "description": "SMPP client and server implementation in node.js", "homepage": "https://github.com/semyonf/node-smpp", "bugs": "https://github.com/semyonf/node-smpp/issues",