Merge pull request #132 from yoo2001818/master

Fix ipcBuffer being shared with all connected sockets
This commit is contained in:
Brandon Nozaki Miller 2019-12-02 00:44:22 -08:00 committed by GitHub
commit 076053ead7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -165,18 +165,18 @@ function gotData(socket,data,UDPSocket){
return; return;
} }
if(!this.ipcBuffer){ if(!sock.ipcBuffer){
this.ipcBuffer=''; sock.ipcBuffer='';
} }
data=(this.ipcBuffer+=data); data=(sock.ipcBuffer+=data);
if(data.slice(-1)!=eventParser.delimiter || data.indexOf(eventParser.delimiter) == -1){ if(data.slice(-1)!=eventParser.delimiter || data.indexOf(eventParser.delimiter) == -1){
this.log('Messages are large, You may want to consider smaller messages.'); this.log('Messages are large, You may want to consider smaller messages.');
return; return;
} }
this.ipcBuffer=''; sock.ipcBuffer='';
data=eventParser.parse(data); data=eventParser.parse(data);