Skip to content

Commit

Permalink
fix error when end sent before request
Browse files Browse the repository at this point in the history
There was situation when the handler receives 'end' message before
initial 'header' request. The client was fixed warn and continue instead
of crash.
  • Loading branch information
Robin Gottfried committed Jun 5, 2020
1 parent ff1efe7 commit 2750992
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,12 @@ class Channel extends Object {

on_end() {
debug(` :> ${this.id} end`);
this.request.end();
if (this.request) {
this.request.end();
} else {
warning(`Received end before I was able to create a request.`);
setTimeout(()=>console.log(`Request: ${this.request}`), 100);
}
}

onHttpData(chunk) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "karmen_ws",
"version": "1.0.3",
"version": "1.0.4",
"description": "",
"main": "client",
"scripts": {
Expand Down

0 comments on commit 2750992

Please sign in to comment.