Skip to content

Commit

Permalink
Add pausing and resuming of streams.
Browse files Browse the repository at this point in the history
The currently buffered data will still be emitted though.
  • Loading branch information
yorickvP committed Oct 1, 2011
1 parent f041e77 commit 04cd177
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions httpapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var SCGIServer = require('./index.js')
, net = require('net')
, http = require('http')
, util = require('util')
, Stream = require('stream').Stream
, EventEmitter = require('events').EventEmitter
exports.Server = function Server() {
net.Server.call(this)
Expand Down Expand Up @@ -41,8 +42,11 @@ exports.ServerRequest = function ServerRequest(socket, headers, data) {
else socket.on('end', self.emit.bind(self, 'end')) })}

exports.ServerRequest.prototype = new EventEmitter()
exports.ServerRequest.pause = function() { throw "pausing not implemented" }
exports.ServerRequest.resume = function() { throw "pausing not implemented" }
exports.ServerRequest.prototype.pause = function() {
this.connection.pause() }
exports.ServerRequest.prototype.resume = function() {
this.connection.resume() }
exports.ServerRequest.prototype.pipe = Stream.prototype.pipe

exports.ServerResponse = function ServerResponse(req) {
EventEmitter.call(this)
Expand Down

0 comments on commit 04cd177

Please sign in to comment.