mirror of https://github.com/cbeuw/Cloak
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
|
left := dataLength
|
||||||
readPtr := 5
|
readPtr := 5
|
||||||
|
|
||||||
// TODO: Deadline here?
|
|
||||||
for left != 0 {
|
for left != 0 {
|
||||||
// If left > buffer size (i.e. our message got segmented), the entire MTU is read
|
// 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, the entire buffer is all there left to read
|
||||||
// if left < buffer size (i.e. multiple messages came together),
|
// if left < buffer size (i.e. multiple messages came together),
|
||||||
// only the message we want is read
|
// 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 = conn.Read(buffer[readPtr : readPtr+left])
|
||||||
i, err = io.ReadFull(conn, buffer[readPtr:readPtr+left])
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue