else
len = chunk.length;
- if (this.connection)
+ if (this.connection && !this.connection.corked) {
this.connection.cork();
+ var conn = this.connection;
+ process.nextTick(function connectionCork() {
+ if (conn)
+ conn.uncork();
+ });
+ }
this._send(len.toString(16), 'binary', null);
this._send(crlf_buf, null, null);
this._send(chunk, encoding, null);
ret = this._send(crlf_buf, null, callback);
- if (this.connection)
- this.connection.uncork();
}
} else {
ret = this._send(chunk, encoding, callback);