Merge pull request #3523 from guillaumebort/1.0.x

Sbt server could miss some messages
This commit is contained in:
eugene yokota
2017-09-15 23:31:13 -04:00
committed by GitHub
3 changed files with 11 additions and 4 deletions
@@ -30,8 +30,8 @@ abstract class ServerConnection(connection: Socket) {
bytesRead = in.read(readBuffer)
buffer = buffer ++ readBuffer.toVector.take(bytesRead)
// handle un-framing
val delimPos = buffer.indexOf(delimiter)
if (delimPos > 0) {
var delimPos = buffer.indexOf(delimiter)
while (delimPos > -1) {
val chunk = buffer.take(delimPos)
buffer = buffer.drop(delimPos + 1)
@@ -47,6 +47,7 @@ abstract class ServerConnection(connection: Socket) {
case event: StringEvent => onLogEntry(event)
}
)
delimPos = buffer.indexOf(delimiter)
}
} catch {
@@ -29,8 +29,8 @@ final class NetworkChannel(val name: String, connection: Socket, structure: Buil
bytesRead = in.read(readBuffer)
buffer = buffer ++ readBuffer.toVector.take(bytesRead)
// handle un-framing
val delimPos = buffer.indexOf(delimiter)
if (delimPos > 0) {
var delimPos = buffer.indexOf(delimiter)
while (delimPos > -1) {
val chunk = buffer.take(delimPos)
buffer = buffer.drop(delimPos + 1)
@@ -40,6 +40,7 @@ final class NetworkChannel(val name: String, connection: Socket, structure: Buil
errorDesc => println("Got invalid chunk from client: " + errorDesc),
onCommand
)
delimPos = buffer.indexOf(delimiter)
}
} catch {
+5
View File
@@ -0,0 +1,5 @@
### Bug fixes
- In some cases sbt server was missing some messages. By [@guillaumebort][@guillaumebort].
[@guillaumebort]: https://github.com/guillaumebort