MCPcopy
hub / github.com/grpc/grpc-go / OnCallBegin

Method OnCallBegin

internal/idle/idle.go:193–208  ·  view source on GitHub ↗

OnCallBegin is invoked at the start of every RPC.

()

Source from the content-addressed store, hash-verified

191
192// OnCallBegin is invoked at the start of every RPC.
193func (m *Manager) OnCallBegin() {
194 if m.isClosed() {
195 return
196 }
197
198 if atomic.AddInt32(&m.activeCallsCount, 1) > 0 {
199 // Channel is not idle now. Set the activity bit and allow the call.
200 atomic.StoreInt32(&m.activeSinceLastTimerCheck, 1)
201 return
202 }
203
204 // Channel is either in idle mode or is in the process of moving to idle
205 // mode. Attempt to exit idle mode to allow this RPC.
206 m.ExitIdleMode()
207 atomic.StoreInt32(&m.activeSinceLastTimerCheck, 1)
208}
209
210// ExitIdleMode instructs m to call the ClientConn's ExitIdleMode and update its
211// internal state.

Calls 2

isClosedMethod · 0.95
ExitIdleModeMethod · 0.95