Merge pull request #421 from TutoringAustralasia/manual_buffer_flushing

Adding support for manual buffer flushing
This commit is contained in:
Guillermo Rauch
2012-07-09 08:42:15 -07:00
3 changed files with 76 additions and 2 deletions

View File

@@ -36,6 +36,7 @@
, 'sync disconnect on unload': true
, 'auto connect': true
, 'flash policy port': 10843
, 'manualFlush': false
};
io.util.merge(this.options, options);
@@ -311,11 +312,25 @@
this.doBuffer = v;
if (!v && this.connected && this.buffer.length) {
this.transport.payload(this.buffer);
this.buffer = [];
if (!this.options['manualFlush']) {
this.flushBuffer();
}
}
};
/**
* Flushes the buffer data over the wire.
* To be invoked manually when 'manualFlush' is set to true.
*
* @api public
*/
Socket.prototype.flushBuffer = function() {
this.transport.payload(this.buffer);
this.buffer = [];
};
/**
* Disconnect the established connect.
*