MCPcopy
hub / github.com/cloudflare/cloudflared / Write

Method Write

quic/safe_stream.go:38–53  ·  view source on GitHub ↗
(p []byte)

Source from the content-addressed store, hash-verified

36}
37
38func (s *SafeStreamCloser) Write(p []byte) (n int, err error) {
39 s.lock.Lock()
40 defer s.lock.Unlock()
41 if s.writeTimeout > 0 {
42 err = s.stream.SetWriteDeadline(time.Now().Add(s.writeTimeout))
43 if err != nil {
44 log.Err(err).Msg("Error setting write deadline for QUIC stream")
45 }
46 }
47 nBytes, err := s.stream.Write(p)
48 if err != nil {
49 s.handleWriteError(err)
50 }
51
52 return nBytes, err
53}
54
55// Handles the timeout error in case it happened, by canceling the stream write.
56func (s *SafeStreamCloser) handleWriteError(err error) {

Callers 1

quicServerFunction · 0.95

Calls 5

handleWriteErrorMethod · 0.95
SetWriteDeadlineMethod · 0.80
AddMethod · 0.65
WriteMethod · 0.65
ErrMethod · 0.45

Tested by 1

quicServerFunction · 0.76