Skip to content
Snippets Groups Projects
Commit 3525c2e1 authored by deuce's avatar deuce
Browse files

Don't TX or RX on unconncted sockets. recv() on an unconnected socket

crashes jsexec (for now).
parent 8bccd1a8
No related branches found
No related tags found
No related merge requests found
......@@ -942,6 +942,11 @@ function handle_request() {
}
}
if (!this.is_connected) {
close_sock(this);
return;
}
block = this.recv(4096);
if (block !== null)
buf += block;
......@@ -991,11 +996,13 @@ function handle_request() {
function handle_tx() {
var sent = 0;
if (this.LORD.txbuf.length > 0)
sent = this.send(this.LORD.txbuf);
this.LORD.txbuf = this.LORD.txbuf.substr(sent);
if (this.LORD.txbuf.length === 0) {
wrsocks.splice(wrsocks.indexOf(this), 1);
if (this.is_connected) {
if (this.LORD.txbuf.length > 0)
sent = this.send(this.LORD.txbuf);
this.LORD.txbuf = this.LORD.txbuf.substr(sent);
if (this.LORD.txbuf.length === 0) {
wrsocks.splice(wrsocks.indexOf(this), 1);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment