fixed buffer error from issue #11
This commit is contained in:
parent
9df9066423
commit
7d8ecd1f7e
4 changed files with 26 additions and 2 deletions
|
@ -15,7 +15,7 @@ ipc.serve(
|
|||
ipc.server.on(
|
||||
'app.message',
|
||||
function(data,socket){
|
||||
ipc.log('got a message from'.debug, (data.id).variable, (data.message).data);
|
||||
//ipc.log('got a message from'.debug, (data.id).variable, (data.message).data);
|
||||
ipc.server.emit(
|
||||
socket,
|
||||
'app.message',
|
||||
|
|
|
@ -115,6 +115,18 @@ function connect(){
|
|||
'data',
|
||||
function(data) {
|
||||
client.log('## recieved events ##'.rainbow);
|
||||
if(!this.ipcBuffer)
|
||||
this.ipcBuffer='';
|
||||
|
||||
data=(this.ipcBuffer+=data);
|
||||
|
||||
if(data.slice(-1)!=eventParser.delimiter){
|
||||
client.log('Socket buffer size exceeded consider smaller messages or a larger buffer.'.warn, 'Implementing software buffer expansion for this message.'.notice);
|
||||
return;
|
||||
}
|
||||
|
||||
this.ipcBuffer='';
|
||||
|
||||
var events = eventParser.parse(data);
|
||||
var eCount = events.length;
|
||||
for(var i=0; i<eCount; i++){
|
||||
|
|
|
@ -166,6 +166,18 @@ function init(path,config,log,port){
|
|||
socket.on(
|
||||
'data',
|
||||
function(data,UDPSocket){
|
||||
if(!this.ipcBuffer)
|
||||
this.ipcBuffer='';
|
||||
|
||||
data=(this.ipcBuffer+=data);
|
||||
|
||||
if(data.slice(-1)!=eventParser.delimiter){
|
||||
server.log('Socket buffer size exceeded, consider smaller messages or a larger buffer.'.warn, 'Implementing software buffer expansion for this message.'.notice);
|
||||
return;
|
||||
}
|
||||
|
||||
this.ipcBuffer='';
|
||||
|
||||
data=eventParser.parse(data);
|
||||
var sock=((server.udp4 || server.udp6)? UDPSocket : socket);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "node-ipc",
|
||||
"version": "0.9.13",
|
||||
"version": "0.9.15",
|
||||
"description": "A nodejs module for local and remote Inter Process Communication (IPC), Neural Networking, and able to facilitate machine learning.",
|
||||
"main": "node-ipc.js",
|
||||
"directories": {
|
||||
|
|
Loading…
Reference in a new issue