OnCallBegin is invoked at the start of every RPC.
()
| 191 | |
| 192 | // OnCallBegin is invoked at the start of every RPC. |
| 193 | func (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. |