MCPcopy Create free account
hub / github.com/modelcontextprotocol/go-sdk / startPOST

Method startPOST

mcp/streamable.go:78–93  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

76// streams, but that is tricy to implement. Clients should generally make
77// keepalive pings if they want to keep the session live.
78func (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.

Callers 1

ServeHTTPMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected