Read implements io.Read
(buf []byte)
| 83 | |
| 84 | // Read implements io.Read |
| 85 | func (s *Stream) Read(buf []byte) (n int, err error) { |
| 86 | //log.Tracef("attempting to read from stream %v", s.id) |
| 87 | if len(buf) == 0 { |
| 88 | return 0, nil |
| 89 | } |
| 90 | |
| 91 | n, err = s.recvBuf.Read(buf) |
| 92 | log.Tracef("%v read from stream %v with err %v", n, s.id, err) |
| 93 | if err == io.EOF { |
| 94 | return n, ErrBrokenStream |
| 95 | } |
| 96 | return |
| 97 | } |
| 98 | |
| 99 | func (s *Stream) obfuscateAndSend(buf []byte, payloadOffsetInBuf int) error { |
| 100 | cipherTextLen, err := s.session.obfuscate(&s.writingFrame, buf, payloadOffsetInBuf) |
no outgoing calls