MCPcopy Index your code
hub / github.com/XTLS/REALITY / Read

Method Read

tls.go:70–82  ·  view source on GitHub ↗
(b []byte)

Source from the content-addressed store, hash-verified

68}
69
70func (c *MirrorConn) Read(b []byte) (int, error) {
71 c.Unlock()
72 runtime.Gosched()
73 n, err := c.Conn.Read(b)
74 c.Lock() // calling c.Lock() before c.Target.Write(), to make sure that this goroutine has the priority to make the next move
75 if n != 0 {
76 c.Target.Write(b[:n])
77 }
78 if err != nil {
79 c.Target.Close()
80 }
81 return n, err
82}
83
84func (c *MirrorConn) Write(b []byte) (int, error) {
85 return 0, fmt.Errorf("Write(%v)", len(b))

Callers 2

ReadMethod · 0.45
ServerFunction · 0.45

Calls 2

WriteMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected