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 33
33
// HTTPClient. The timeout includes connection time, any redirects,
34
34
// and reading the response body.
35
35
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
36
39
)
37
40
38
41
// Client represents a connection with the APNs
@@ -63,7 +66,11 @@ func NewClient(certificate tls.Certificate) *Client {
63
66
transport := & http2.Transport {
64
67
TLSClientConfig : tlsConfig ,
65
68
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 )
67
74
},
68
75
}
69
76
return & Client {
You can’t perform that action at this time.
0 commit comments