aboutsummaryrefslogtreecommitdiff
path: root/stream_handler.go
diff options
context:
space:
mode:
authorEmiliano Ciavatta2020-04-03 16:06:25 +0000
committerEmiliano Ciavatta2020-04-03 16:06:25 +0000
commit590405d948530aecdf7399833c3d0b8585f5601b (patch)
tree1da00489518fcfb786e8262841ab2492957aed0c /stream_handler.go
parent9883cd346f694ad09aac839f9ddc4a25df0e0b0a (diff)
Add stream_handler tests
Diffstat (limited to 'stream_handler.go')
-rw-r--r--stream_handler.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/stream_handler.go b/stream_handler.go
index 80d91d6..ce580fc 100644
--- a/stream_handler.go
+++ b/stream_handler.go
@@ -135,7 +135,7 @@ func (sh *StreamHandler) onMatch(id uint, from uint64, to uint64, flags uint, co
// new from == new match
sh.patternMatches[id] = append(patternSlices, PatternSlice{from, to})
} else {
- patternSlices = make([]PatternSlice, InitialPatternSliceSize)
+ patternSlices = make([]PatternSlice, 1, InitialPatternSliceSize)
patternSlices[0] = PatternSlice{from, to}
sh.patternMatches[id] = patternSlices
}
@@ -169,7 +169,7 @@ func (sh *StreamHandler) generateDocumentKey() string {
endpointsHash := sh.streamKey[0].FastHash() ^ sh.streamKey[1].FastHash() ^
sh.streamKey[2].FastHash() ^ sh.streamKey[3].FastHash()
binary.BigEndian.PutUint64(hash, endpointsHash)
- binary.BigEndian.PutUint64(hash[8:], uint64(sh.timestamps[0].UnixNano()))
+ binary.BigEndian.PutUint64(hash[8:], uint64(sh.firstPacketSeen.UnixNano()))
binary.BigEndian.PutUint16(hash[8:], uint16(len(sh.documentsKeys)))
return fmt.Sprintf("%x", hash)