mcp: fix reconnect semantics for hanging GET
A few problems with reconnection cropped up in the review of PR #307. We should allow for the hanging GET to fail with StatusMethodNotAllowed. This simply means that the server does not support sending notifications or requests over the GET, which is allowed in the spec. Also, we should fix the initial delay of the hanging GET request: it should start with 0 delay. Fix the math for this and subsequent attempts. Incidentally, this makes the tests take 3s on my machine, down from 9s. Also address some comments from #307.
This commit is contained in:
parent
98e67fdf62
commit
1a54234c27
1 changed files with 43 additions and 29 deletions
|
|
@ -742,8 +742,8 @@ func (c *Connection) write(ctx context.Context, msg Message) error {
|
|||
var err error
|
||||
// Fail writes immediately if the connection is shutting down.
|
||||
//
|
||||
// TODO(rfindley): should we allow cancellation notifations through? It could
|
||||
// be the case that writes can still succeed.
|
||||
// TODO(rfindley): should we allow cancellation notifications through? It
|
||||
// could be the case that writes can still succeed.
|
||||
c.updateInFlight(func(s *inFlightState) {
|
||||
err = s.shuttingDown(ErrServerClosing)
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue