Compare commits

...

3 Commits

Author SHA1 Message Date
semantic-release-bot 1c0d11ccb0 chore(release): 0.0.2-develop.13 [skip ci]
## [0.0.2-develop.13](https://git.lumeweb.com/LumeWeb/kernel-swarm-client/compare/v0.0.2-develop.12...v0.0.2-develop.13) (2023-07-22)

### Bug Fixes

* on write and end, log errors if we are trying to use a closed socket ([57efedd](57efedd0af))
2023-07-22 11:12:45 +00:00
Derrick Hammer 0747c0b31f
Merge remote-tracking branch 'origin/develop' into develop 2023-07-22 07:11:52 -04:00
Derrick Hammer 57efedd0af
fix: on write and end, log errors if we are trying to use a closed socket 2023-07-22 07:11:48 -04:00
4 changed files with 21 additions and 5 deletions

View File

@ -1,3 +1,10 @@
## [0.0.2-develop.13](https://git.lumeweb.com/LumeWeb/kernel-swarm-client/compare/v0.0.2-develop.12...v0.0.2-develop.13) (2023-07-22)
### Bug Fixes
* on write and end, log errors if we are trying to use a closed socket ([57efedd](https://git.lumeweb.com/LumeWeb/kernel-swarm-client/commit/57efedd0affd5e647db185aff0ba1be2a137aef3))
## [0.0.2-develop.12](https://git.lumeweb.com/LumeWeb/kernel-swarm-client/compare/v0.0.2-develop.11...v0.0.2-develop.12) (2023-07-22)

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@lumeweb/kernel-swarm-client",
"version": "0.0.2-develop.12",
"version": "0.0.2-develop.13",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/kernel-swarm-client",
"version": "0.0.2-develop.12",
"version": "0.0.2-develop.13",
"dependencies": {
"@lumeweb/libkernel": "^0.1.0-develop.9",
"async-mutex": "^0.4.0",

View File

@ -1,6 +1,6 @@
{
"name": "@lumeweb/kernel-swarm-client",
"version": "0.0.2-develop.12",
"version": "0.0.2-develop.13",
"type": "module",
"main": "lib/index.js",
"repository": {

View File

@ -229,15 +229,24 @@ export class Socket extends Client {
}
write(message: string | Buffer): void {
this.callModule("socketExists", { id: this.id }).then(
([exists]: ErrTuple) => {
if (!exists) {
logErr("tried to write to closed socket");
}
this.callModule("socketWrite", { id: this.id, message });
},
);
this.callModule("socketWrite", { id: this.id, message });
}
end(): void {
this.callModule("socketExists", { id: this.id }).then(
([exists]: ErrTuple) => {
if (exists) {
this.callModule("socketClose", { id: this.id });
if (!exists) {
logErr("tried to close a closed socket");
}
this.callModule("socketClose", { id: this.id });
},
);
}