File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 3333 // HTTPClient. The timeout includes connection time, any redirects,
3434 // and reading the response body.
3535 HTTPClientTimeout = 60 * time .Second
36+ // TCPKeepAlive specifies the keep-alive period for an active network
37+ // connection. If zero, keep-alives are not enabled.
38+ TCPKeepAlive = 60 * time .Second
3639)
3740
3841// Client represents a connection with the APNs
@@ -63,7 +66,11 @@ func NewClient(certificate tls.Certificate) *Client {
6366 transport := & http2.Transport {
6467 TLSClientConfig : tlsConfig ,
6568 DialTLS : func (network , addr string , cfg * tls.Config ) (net.Conn , error ) {
66- return tls .DialWithDialer (& net.Dialer {Timeout : TLSDialTimeout }, network , addr , cfg )
69+ dialer := & net.Dialer {
70+ Timeout : TLSDialTimeout ,
71+ KeepAlive : TCPKeepAlive ,
72+ }
73+ return tls .DialWithDialer (dialer , network , addr , cfg )
6774 },
6875 }
6976 return & Client {
You can’t perform that action at this time.
0 commit comments