MCPcopy
hub / github.com/syncthing/syncthing / handleRequest

Method handleRequest

lib/protocol/protocol.go:672–691  ·  view source on GitHub ↗
(req *Request)

Source from the content-addressed store, hash-verified

670}
671
672func (c *rawConnection) handleRequest(req *Request) {
673 res, err := c.model.Request(req)
674 if err != nil {
675 resp := &Response{
676 ID: req.ID,
677 Code: errorToCode(err),
678 }
679 c.send(context.Background(), resp.toWire(), nil)
680 return
681 }
682 done := make(chan struct{})
683 resp := &Response{
684 ID: req.ID,
685 Data: res.Data(),
686 Code: errorToCode(nil),
687 }
688 c.send(context.Background(), resp.toWire(), done)
689 <-done
690 res.Close()
691}
692
693func (c *rawConnection) handleResponse(resp *Response) {
694 c.awaitingMut.Lock()

Callers 1

dispatcherLoopMethod · 0.95

Calls 6

sendMethod · 0.95
toWireMethod · 0.95
errorToCodeFunction · 0.85
RequestMethod · 0.65
DataMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected