defaults.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. *
  3. * Copyright 2018 gRPC authors.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. */
  18. package transport
  19. import (
  20. "math"
  21. "time"
  22. )
  23. const (
  24. // The default value of flow control window size in HTTP2 spec.
  25. defaultWindowSize = 65535
  26. // The initial window size for flow control.
  27. initialWindowSize = defaultWindowSize // for an RPC
  28. infinity = time.Duration(math.MaxInt64)
  29. defaultClientKeepaliveTime = infinity
  30. defaultClientKeepaliveTimeout = 20 * time.Second
  31. defaultMaxStreamsClient = 100
  32. defaultMaxConnectionIdle = infinity
  33. defaultMaxConnectionAge = infinity
  34. defaultMaxConnectionAgeGrace = infinity
  35. defaultServerKeepaliveTime = 2 * time.Hour
  36. defaultServerKeepaliveTimeout = 20 * time.Second
  37. defaultKeepalivePolicyMinTime = 5 * time.Minute
  38. // max window limit set by HTTP2 Specs.
  39. maxWindowSize = math.MaxInt32
  40. // defaultWriteQuota is the default value for number of data
  41. // bytes that each stream can schedule before some of it being
  42. // flushed out.
  43. defaultWriteQuota = 64 * 1024
  44. defaultClientMaxHeaderListSize = uint32(16 << 20)
  45. defaultServerMaxHeaderListSize = uint32(16 << 20)
  46. )
  47. // MaxStreamID is the upper bound for the stream ID before the current
  48. // transport gracefully closes and new transport is created for subsequent RPCs.
  49. // This is set to 75% of 2^31-1. Streams are identified with an unsigned 31-bit
  50. // integer. It's exported so that tests can override it.
  51. var MaxStreamID = uint32(math.MaxInt32 * 3 / 4)