77 Commits
Author SHA1 Message Date
Daniel Jimenez Garcia 37e388a1c1 163, allow connection through HTTP proxy 2017-11-16 10:58:41 +01:00
Darren e0f7a54052 Change _pingedThreshold to 2.5 times of headbeat
Change _pingedThreshold to 2.5 times the configured heartbeat (set in this.options.heartBeat)
2017-02-04 11:11:28 -08:00
Darren Koh 25b5e54329 Update syntax format 2016-12-01 17:05:07 -08:00
Darren Koh 2222ff92f1 Add code coverage 2016-11-29 22:37:55 -08:00
Darren Koh 3bef9f012e Fix warning on Codacy 2016-11-28 10:29:36 -08:00
Darren Koh 5b7c778aea Change heatBeat default to 60 seconds 2016-11-23 17:25:38 -08:00
Darren Koh 914fd59719 Fix null value 2016-11-23 11:40:05 -08:00
Darren Koh 1958884c38 Take care of idle connection and Token expiration.
- Add Ping frame (set heartBeat in apnOptions)
- Add token expiration check prior to sending Push, it is suspected that if token is expired passing certain threshold, APNS will not response to the Push request (will response after 15 minutes of Push Request)
2016-11-23 11:02:26 -08:00
Florian Reinhart fac48d95a4 Fix deprecation warnings for Buffer 2016-11-02 11:14:37 +01:00
Andrew Naylor fd922fb2d8 Fix Codacy Code Style issues 2016-09-25 20:31:06 +01:00
Andrew Naylor a23b5f2985 Ensure we reset the failure count
If we don't reset the failure count then the pending notification queue
will stall without warning. Instead it seems fair that if the
application continues to send notifications then we give it another
shot and attempt 3 more times.

This has the effect of never really "hard" failing but all notifications
are handled and the application can take responsibility for abandoning
the worker if they are monitoring the errors correctly.
2016-09-21 22:23:05 +01:00
Andrew Naylor 8b5ae992ff Fix Codacy issues 2016-09-21 10:29:07 +01:00
Andrew Naylor 0e01d49ba9 Handle GOAWAY events 2016-09-21 01:59:27 +01:00
Andrew Naylor fe3b8352ad Ensure that end gets bubbled
Otherwise endpointManager might not continue sending
2016-09-21 01:04:33 +01:00
Andrew Naylor 7a3d3f48ea Wait until close to trigger stream errors 2016-09-21 01:04:14 +01:00
Andrew Naylor cdb689a1f4 Handle errors from all HTTP/2 components
Because we don't `throw` the resulting message we don't need to
package it in an error. It will be wrapped in a VError accordingly.
2016-09-21 00:31:47 +01:00
Andrew Naylor 1e81a7d1cd Ensure we convert connection errors to an Error
It normally emits strings which is bad but we can deal with it. The
Promises wouldn't be happy otherwise.
2016-09-20 21:44:55 +01:00
Andrew Naylor 4fedc00742 Propagate errors to pending streams 2016-09-20 12:15:09 +01:00
Andrew Naylor 518eeacbe5 Ensure the stream is allocated an ID
We need to ensure a stream has entered the `_streamIds` array so we can
loop over it if an error occurs.

If an error occurs we need to clean up old streams by bubbling the error
through to them, allowing their corresponding promise to be rejected. If
the error doesn't make it through the promise will stall forever.

An error occurring between a stream being created (popping it from the
client queue) and having data written (when it would normally be
allocated an ID) then it can end up in limbo because looping through
`streamIds` would not hit that stream.
2016-09-20 11:45:18 +01:00
Andrew Naylor 7c9cac7706 Ensure we can establish new connections in wakeup 2016-09-19 18:44:46 +01:00
Andrew Naylor 643b0946e2 Ensure that errors trigger a wakeup 2016-09-19 17:00:36 +01:00
Andrew Naylor 79b9cb00de Only count connection failures with no established 2016-09-19 15:18:47 +01:00
Andrew Naylor 196e56062d Wakeup endpoint manager when connection ends 2016-09-18 19:14:57 +01:00
Andrew Naylor a28b460f79 Ensure new connections aren't established at limit 2016-09-18 19:10:18 +01:00
Andrew Naylor 985aec3f53 Always emit wakeup
We may need to depend on `wakeup` in Client to cleanup pending
notifications if all connections fail
2016-09-18 18:02:35 +01:00
Andrew Naylor 2e5472f4fb Wrap endpoint errors before passing them on 2016-09-06 08:40:26 +01:00
Andrew Naylor a857c8894c Fix codacy style issues 2016-08-09 21:14:46 +01:00
Andrew Naylor 0d2b686e3d Ensure that pending connections are closed 2016-08-09 21:09:44 +01:00
Andrew Naylor 85f4eb2c92 Implement shutdown 2016-08-09 20:43:43 +01:00
Andrew Naylor ea0ef5f6d5 Break out the endpoint cleanup 2016-06-26 01:13:47 +01:00
Andrew Naylor 4f25e5ce98 Fix a codacy issue 2016-06-26 01:06:28 +01:00
Andrew Naylor c0b0874de0 Ensure only pre-connect errors are failures 2016-06-25 19:18:32 +01:00
Andrew Naylor 69920ae2ff Ensure we don't stomp on pending connections 2016-06-25 19:14:29 +01:00
Andrew Naylor c0337c4c4d Ensure an errored connection is not used 2016-06-25 18:56:46 +01:00
Andrew Naylor 46c9213afd Ensure ended sockets are cleaned up 2016-06-25 17:37:56 +01:00
Andrew Naylor e439601dd9 Simplify the index arithmetic 2016-06-17 13:29:06 +02:00
Andrew Naylor 70f6fc029d Implement round-robin connections 2016-06-03 19:16:43 +01:00
Andrew Naylor b30bb49ab5 Enforce maxConnections limit 2016-05-31 08:41:01 +01:00
Andrew Naylor c836908329 Reinstate connectionRetryLimit 2016-05-31 08:32:06 +01:00
Andrew Naylor 7ea81fc0e6 Establish multiple connections 2016-05-30 16:55:21 +01:00
Andrew Naylor 9c38768019 Reset the failure count after success 2016-05-30 16:19:07 +01:00
Andrew Naylor 13898f05ee Error-out on multiple connection failure 2016-05-30 15:48:08 +01:00
Andrew Naylor 4c9586fbdc Destroy the socket when error occurs 2016-05-30 01:02:30 +01:00
Andrew Naylor 1b81eb9394 Retab the project 2016-05-30 01:02:19 +01:00
Andrew Naylor 1079095458 Null-out the retain-cycle 2016-05-01 23:55:26 +01:00
Andrew Naylor 08781d0fa3 Improve code coverage and use "bunyan" properly 2016-05-01 15:35:52 +01:00
Andrew Naylor e87f326829 Fix some more codacy issues 2016-04-18 09:56:33 +01:00
Andrew Naylor 07d6782899 Fix code style problems 2016-04-17 20:09:32 +01:00
Andrew Naylor 61be597fc2 Simplify the wakeup behaviour also 2016-03-28 02:28:55 +01:00
Andrew Naylor 51c5fba96c Manage the stream counts within Endpoint
Using the built-in available stream count was not suitable as it is
managed on a different schedule to that which we require. `createStream`
would not increment he used stream count until a frame was actually sent
whereas we want to identify a stream as in-use as soon as it is acquired
so we shall maange a local count.
2016-03-28 02:19:06 +01:00