aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/google.golang.org/grpc/keepalive/keepalive.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/google.golang.org/grpc/keepalive/keepalive.go')
-rw-r--r--vendor/google.golang.org/grpc/keepalive/keepalive.go62
1 files changed, 40 insertions, 22 deletions
diff --git a/vendor/google.golang.org/grpc/keepalive/keepalive.go b/vendor/google.golang.org/grpc/keepalive/keepalive.go
index f8adc7e..899e72d 100644
--- a/vendor/google.golang.org/grpc/keepalive/keepalive.go
+++ b/vendor/google.golang.org/grpc/keepalive/keepalive.go
@@ -16,7 +16,8 @@
16 * 16 *
17 */ 17 */
18 18
19// Package keepalive defines configurable parameters for point-to-point healthcheck. 19// Package keepalive defines configurable parameters for point-to-point
20// healthcheck.
20package keepalive 21package keepalive
21 22
22import ( 23import (
@@ -24,42 +25,59 @@ import (
24) 25)
25 26
26// ClientParameters is used to set keepalive parameters on the client-side. 27// ClientParameters is used to set keepalive parameters on the client-side.
27// These configure how the client will actively probe to notice when a connection is broken 28// These configure how the client will actively probe to notice when a
28// and send pings so intermediaries will be aware of the liveness of the connection. 29// connection is broken and send pings so intermediaries will be aware of the
29// Make sure these parameters are set in coordination with the keepalive policy on the server, 30// liveness of the connection. Make sure these parameters are set in
30// as incompatible settings can result in closing of connection. 31// coordination with the keepalive policy on the server, as incompatible
32// settings can result in closing of connection.
31type ClientParameters struct { 33type ClientParameters struct {
32 // After a duration of this time if the client doesn't see any activity it pings the server to see if the transport is still alive. 34 // After a duration of this time if the client doesn't see any activity it
35 // pings the server to see if the transport is still alive.
33 Time time.Duration // The current default value is infinity. 36 Time time.Duration // The current default value is infinity.
34 // After having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that 37 // After having pinged for keepalive check, the client waits for a duration
35 // the connection is closed. 38 // of Timeout and if no activity is seen even after that the connection is
39 // closed.
36 Timeout time.Duration // The current default value is 20 seconds. 40 Timeout time.Duration // The current default value is 20 seconds.
37 // If true, client runs keepalive checks even with no active RPCs. 41 // If true, client sends keepalive pings even with no active RPCs. If false,
42 // when there are no active RPCs, Time and Timeout will be ignored and no
43 // keepalive pings will be sent.
38 PermitWithoutStream bool // false by default. 44 PermitWithoutStream bool // false by default.
39} 45}
40 46
41// ServerParameters is used to set keepalive and max-age parameters on the server-side. 47// ServerParameters is used to set keepalive and max-age parameters on the
48// server-side.
42type ServerParameters struct { 49type ServerParameters struct {
43 // MaxConnectionIdle is a duration for the amount of time after which an idle connection would be closed by sending a GoAway. 50 // MaxConnectionIdle is a duration for the amount of time after which an
44 // Idleness duration is defined since the most recent time the number of outstanding RPCs became zero or the connection establishment. 51 // idle connection would be closed by sending a GoAway. Idleness duration is
52 // defined since the most recent time the number of outstanding RPCs became
53 // zero or the connection establishment.
45 MaxConnectionIdle time.Duration // The current default value is infinity. 54 MaxConnectionIdle time.Duration // The current default value is infinity.
46 // MaxConnectionAge is a duration for the maximum amount of time a connection may exist before it will be closed by sending a GoAway. 55 // MaxConnectionAge is a duration for the maximum amount of time a
47 // A random jitter of +/-10% will be added to MaxConnectionAge to spread out connection storms. 56 // connection may exist before it will be closed by sending a GoAway. A
57 // random jitter of +/-10% will be added to MaxConnectionAge to spread out
58 // connection storms.
48 MaxConnectionAge time.Duration // The current default value is infinity. 59 MaxConnectionAge time.Duration // The current default value is infinity.
49 // MaxConnectinoAgeGrace is an additive period after MaxConnectionAge after which the connection will be forcibly closed. 60 // MaxConnectionAgeGrace is an additive period after MaxConnectionAge after
61 // which the connection will be forcibly closed.
50 MaxConnectionAgeGrace time.Duration // The current default value is infinity. 62 MaxConnectionAgeGrace time.Duration // The current default value is infinity.
51 // After a duration of this time if the server doesn't see any activity it pings the client to see if the transport is still alive. 63 // After a duration of this time if the server doesn't see any activity it
64 // pings the client to see if the transport is still alive.
52 Time time.Duration // The current default value is 2 hours. 65 Time time.Duration // The current default value is 2 hours.
53 // After having pinged for keepalive check, the server waits for a duration of Timeout and if no activity is seen even after that 66 // After having pinged for keepalive check, the server waits for a duration
54 // the connection is closed. 67 // of Timeout and if no activity is seen even after that the connection is
68 // closed.
55 Timeout time.Duration // The current default value is 20 seconds. 69 Timeout time.Duration // The current default value is 20 seconds.
56} 70}
57 71
58// EnforcementPolicy is used to set keepalive enforcement policy on the server-side. 72// EnforcementPolicy is used to set keepalive enforcement policy on the
59// Server will close connection with a client that violates this policy. 73// server-side. Server will close connection with a client that violates this
74// policy.
60type EnforcementPolicy struct { 75type EnforcementPolicy struct {
61 // MinTime is the minimum amount of time a client should wait before sending a keepalive ping. 76 // MinTime is the minimum amount of time a client should wait before sending
77 // a keepalive ping.
62 MinTime time.Duration // The current default value is 5 minutes. 78 MinTime time.Duration // The current default value is 5 minutes.
63 // If true, server expects keepalive pings even when there are no active streams(RPCs). 79 // If true, server allows keepalive pings even when there are no active
80 // streams(RPCs). If false, and client sends ping when there are no active
81 // streams, server will send GOAWAY and close the connection.
64 PermitWithoutStream bool // false by default. 82 PermitWithoutStream bool // false by default.
65} 83}