Fixed crash when transitting long messages.
This commit is contained in:
parent
998f2676e0
commit
591d47ffc3
1 changed files with 4 additions and 1 deletions
|
@ -21,7 +21,10 @@ object Message {
|
||||||
|
|
||||||
val contentLength = (header.Length - MessageHeader.Length).toInt
|
val contentLength = (header.Length - MessageHeader.Length).toInt
|
||||||
val contentBytes = new Array[Byte](contentLength)
|
val contentBytes = new Array[Byte](contentLength)
|
||||||
stream.read(contentBytes, 0, contentLength)
|
var numRead = 0
|
||||||
|
do {
|
||||||
|
numRead += stream.read(contentBytes, numRead, contentLength - numRead)
|
||||||
|
} while (numRead < contentLength)
|
||||||
|
|
||||||
val (crypto, remaining) = CryptoData.read(contentBytes)
|
val (crypto, remaining) = CryptoData.read(contentBytes)
|
||||||
|
|
||||||
|
|
Reference in a new issue