aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--connection_streams_controller.go5
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 {