endPOST signals that a request for this session is ending, starting the timeout if there are no other requests running.
()
| 95 | // endPOST signals that a request for this session is ending, starting the |
| 96 | // timeout if there are no other requests running. |
| 97 | func (i *sessionInfo) endPOST() { |
| 98 | if i.timeout <= 0 { |
| 99 | return |
| 100 | } |
| 101 | |
| 102 | i.timerMu.Lock() |
| 103 | defer i.timerMu.Unlock() |
| 104 | |
| 105 | if i.timer == nil { |
| 106 | return // timer stopped permanently |
| 107 | } |
| 108 | |
| 109 | i.refs-- |
| 110 | assert(i.refs >= 0, "negative ref count") |
| 111 | if i.refs == 0 { |
| 112 | i.timer.Reset(i.timeout) |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | // stopTimer stops the inactivity timer permanently. |
| 117 | func (i *sessionInfo) stopTimer() { |