()
| 805 | } |
| 806 | |
| 807 | var setReqTimeout = function () { |
| 808 | // This timeout sets the amount of time to wait *between* bytes sent |
| 809 | // from the server once connected. |
| 810 | // |
| 811 | // In particular, it's useful for erroring if the server fails to send |
| 812 | // data halfway through streaming a response. |
| 813 | self.req.setTimeout(timeout, function () { |
| 814 | if (self.req) { |
| 815 | self.abort() |
| 816 | var e = new Error('ESOCKETTIMEDOUT') |
| 817 | e.code = 'ESOCKETTIMEDOUT' |
| 818 | e.connect = false |
| 819 | self.emit('error', e) |
| 820 | } |
| 821 | }) |
| 822 | } |
| 823 | if (timeout !== undefined) { |
| 824 | // Only start the connection timer if we're actually connecting a new |
| 825 | // socket, otherwise if we're already connected (because this is a |
no outgoing calls
no test coverage detected
searching dependent graphs…