diff options
author | Emiliano Ciavatta | 2020-07-10 10:19:54 +0000 |
---|---|---|
committer | Emiliano Ciavatta | 2020-07-10 10:19:54 +0000 |
commit | 9a23bd5523b06c0da2731a332ad7b329c8e3355f (patch) | |
tree | 05cee8e13ce3e747982cd29e05e26c5a5756c26e | |
parent | dfa7a89c91c8794ebb5f4cb1836b91e33ebf106e (diff) |
Fix stream content order bug
-rw-r--r-- | connection_streams_controller.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/connection_streams_controller.go b/connection_streams_controller.go index 6c6c962..251e842 100644 --- a/connection_streams_controller.go +++ b/connection_streams_controller.go @@ -77,8 +77,9 @@ func (csc ConnectionStreamsController) GetConnectionPayload(c context.Context, c var payload Payload for !clientStream.ID.IsZero() || !serverStream.ID.IsZero() { - if hasClientBlocks() && !(hasServerBlocks() && // next payload is from client - clientStream.BlocksTimestamps[0].UnixNano() > serverStream.BlocksTimestamps[0].UnixNano()) { + if hasClientBlocks() && (!hasServerBlocks() || // next payload is from client + clientStream.BlocksTimestamps[clientBlocksIndex].UnixNano() <= + serverStream.BlocksTimestamps[serverBlocksIndex].UnixNano()) { start := clientStream.BlocksIndexes[clientBlocksIndex] end := 0 if clientBlocksIndex < len(clientStream.BlocksIndexes)-1 { |