mirror of
https://github.com/cbeuw/Cloak.git
synced 2024-11-15 18:13:29 +00:00
Use normal Read in ReadTLS instead of ReadFull
This commit is contained in:
parent
4fb1f55e2d
commit
59f2fe04e3
@ -58,15 +58,13 @@ func ReadTLS(conn net.Conn, buffer []byte) (n int, err error) {
|
||||
left := dataLength
|
||||
readPtr := 5
|
||||
|
||||
// TODO: Deadline here?
|
||||
for left != 0 {
|
||||
// If left > buffer size (i.e. our message got segmented), the entire MTU is read
|
||||
// if left = buffer size, the entire buffer is all there left to read
|
||||
// if left < buffer size (i.e. multiple messages came together),
|
||||
// only the message we want is read
|
||||
|
||||
// TODO: Why ReadFull here? Shouldn't it be just normal read since we adjust left and readPtr according to read amount?
|
||||
i, err = io.ReadFull(conn, buffer[readPtr:readPtr+left])
|
||||
i, err = conn.Read(buffer[readPtr : readPtr+left])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user