startPOST signals that a POST request for this session is starting (which carries a client->server message), pausing the session timeout if it was running. TODO: we may want to also pause the timer when resuming non-standalone SSE streams, but that is tricy to implement. Clients should generally ma
()
| 76 | // streams, but that is tricy to implement. Clients should generally make |
| 77 | // keepalive pings if they want to keep the session live. |
| 78 | func (i *sessionInfo) startPOST() { |
| 79 | if i.timeout <= 0 { |
| 80 | return |
| 81 | } |
| 82 | |
| 83 | i.timerMu.Lock() |
| 84 | defer i.timerMu.Unlock() |
| 85 | |
| 86 | if i.timer == nil { |
| 87 | return // timer stopped permanently |
| 88 | } |
| 89 | if i.refs == 0 { |
| 90 | i.timer.Stop() |
| 91 | } |
| 92 | i.refs++ |
| 93 | } |
| 94 | |
| 95 | // endPOST signals that a request for this session is ending, starting the |
| 96 | // timeout if there are no other requests running. |