http2Server implements the ServerTransport interface with HTTP2.
| 74 | |
| 75 | // http2Server implements the ServerTransport interface with HTTP2. |
| 76 | type http2Server struct { |
| 77 | lastRead int64 // Keep this field 64-bit aligned. Accessed atomically. |
| 78 | done chan struct{} |
| 79 | conn net.Conn |
| 80 | loopy *loopyWriter |
| 81 | readerDone chan struct{} // sync point to enable testing. |
| 82 | loopyWriterDone chan struct{} |
| 83 | peer peer.Peer |
| 84 | inTapHandle tap.ServerInHandle |
| 85 | framer *framer |
| 86 | // The max number of concurrent streams. |
| 87 | maxStreams uint32 |
| 88 | // controlBuf delivers all the control related tasks (e.g., window |
| 89 | // updates, reset streams, and various settings) to the controller. |
| 90 | controlBuf *controlBuffer |
| 91 | fc *trInFlow |
| 92 | stats stats.Handler |
| 93 | // Keepalive and max-age parameters for the server. |
| 94 | kp keepalive.ServerParameters |
| 95 | // Keepalive enforcement policy. |
| 96 | kep keepalive.EnforcementPolicy |
| 97 | // The time instance last ping was received. |
| 98 | lastPingAt time.Time |
| 99 | // Number of times the client has violated keepalive ping policy so far. |
| 100 | pingStrikes uint8 |
| 101 | // Flag to signify that number of ping strikes should be reset to 0. |
| 102 | // This is set whenever data or header frames are sent. |
| 103 | // 1 means yes. |
| 104 | resetPingStrikes uint32 // Accessed atomically. |
| 105 | initialWindowSize int32 |
| 106 | bdpEst *bdpEstimator |
| 107 | maxSendHeaderListSize *uint32 |
| 108 | |
| 109 | mu sync.Mutex // guard the following |
| 110 | |
| 111 | // drainEvent is initialized when Drain() is called the first time. After |
| 112 | // which the server writes out the first GoAway(with ID 2^31-1) frame. Then |
| 113 | // an independent goroutine will be launched to later send the second |
| 114 | // GoAway. During this time we don't want to write another first GoAway(with |
| 115 | // ID 2^31 -1) frame. Thus call to Drain() will be a no-op if drainEvent is |
| 116 | // already initialized since draining is already underway. |
| 117 | drainEvent *grpcsync.Event |
| 118 | state transportState |
| 119 | activeStreams map[uint32]*ServerStream |
| 120 | // idle is the time instant when the connection went idle. |
| 121 | // This is either the beginning of the connection or when the number of |
| 122 | // RPCs go down to 0. |
| 123 | // When the connection is busy, this value is set to 0. |
| 124 | idle time.Time |
| 125 | |
| 126 | // Fields below are for channelz metric collection. |
| 127 | channelz *channelz.Socket |
| 128 | bufferPool mem.BufferPool |
| 129 | |
| 130 | connectionID uint64 |
| 131 | |
| 132 | // maxStreamMu guards the maximum stream ID |
| 133 | // This lock may not be taken if mu is already held. |
nothing calls this directly
no outgoing calls
no test coverage detected