mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-06-28 00:59:58 +00:00
Update cleaner.go, grpc_assembler.go, and 2 more files...
This commit is contained in:
parent
2c77267250
commit
bb3481e93c
@ -20,7 +20,7 @@ type Cleaner struct {
|
|||||||
cleanPeriod time.Duration
|
cleanPeriod time.Duration
|
||||||
connectionTimeout time.Duration
|
connectionTimeout time.Duration
|
||||||
stats CleanerStats
|
stats CleanerStats
|
||||||
statsMutex sync.Mutex
|
statsMutex sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cl *Cleaner) clean() {
|
func (cl *Cleaner) clean() {
|
||||||
|
@ -43,7 +43,7 @@ func (fbs *fragmentsByStream) appendFrame(streamID uint32, frame http2.Frame) {
|
|||||||
if existingFragment, ok := (*fbs)[streamID]; ok {
|
if existingFragment, ok := (*fbs)[streamID]; ok {
|
||||||
existingDataLen := len(existingFragment.data)
|
existingDataLen := len(existingFragment.data)
|
||||||
// Never save more than maxHTTP2DataLen bytes
|
// Never save more than maxHTTP2DataLen bytes
|
||||||
numBytesToAppend := int(math.Min(float64(maxHTTP2DataLen- existingDataLen), float64(newDataLen)))
|
numBytesToAppend := int(math.Min(float64(maxHTTP2DataLen - existingDataLen), float64(newDataLen)))
|
||||||
|
|
||||||
existingFragment.data = append(existingFragment.data, frame.Data()[:numBytesToAppend]...)
|
existingFragment.data = append(existingFragment.data, frame.Data()[:numBytesToAppend]...)
|
||||||
} else {
|
} else {
|
||||||
@ -77,7 +77,7 @@ func createGrpcAssembler(b *bufio.Reader) GrpcAssembler {
|
|||||||
|
|
||||||
type GrpcAssembler struct {
|
type GrpcAssembler struct {
|
||||||
fragmentsByStream fragmentsByStream
|
fragmentsByStream fragmentsByStream
|
||||||
framer *http2.Framer
|
framer *http2.Framer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ga *GrpcAssembler) readMessage() (uint32, interface{}, string, error) {
|
func (ga *GrpcAssembler) readMessage() (uint32, interface{}, string, error) {
|
||||||
@ -112,15 +112,15 @@ func (ga *GrpcAssembler) readMessage() (uint32, interface{}, string, error) {
|
|||||||
var messageHTTP1 interface{}
|
var messageHTTP1 interface{}
|
||||||
if _, ok := headersHTTP1[":method"]; ok {
|
if _, ok := headersHTTP1[":method"]; ok {
|
||||||
messageHTTP1 = http.Request{
|
messageHTTP1 = http.Request{
|
||||||
Header: headersHTTP1,
|
Header: headersHTTP1,
|
||||||
Proto: protoHTTP2,
|
Proto: protoHTTP2,
|
||||||
ProtoMajor: protoMajorHTTP2,
|
ProtoMajor: protoMajorHTTP2,
|
||||||
ProtoMinor: protoMinorHTTP2,
|
ProtoMinor: protoMinorHTTP2,
|
||||||
}
|
}
|
||||||
} else if _, ok := headersHTTP1[":status"]; ok {
|
} else if _, ok := headersHTTP1[":status"]; ok {
|
||||||
messageHTTP1 = http.Response{
|
messageHTTP1 = http.Response{
|
||||||
Header: headersHTTP1,
|
Header: headersHTTP1,
|
||||||
Proto: protoHTTP2,
|
Proto: protoHTTP2,
|
||||||
ProtoMajor: protoMajorHTTP2,
|
ProtoMajor: protoMajorHTTP2,
|
||||||
ProtoMinor: protoMinorHTTP2,
|
ProtoMinor: protoMinorHTTP2,
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ var dumpToHar = flag.Bool("hardump", false, "Dump traffic to har files")
|
|||||||
var harOutputDir = flag.String("hardir", "output", "Directory in which to store output har files")
|
var harOutputDir = flag.String("hardir", "output", "Directory in which to store output har files")
|
||||||
var harEntriesPerFile = flag.Int("harentriesperfile", 200, "Number of max number of har entries to store in each file")
|
var harEntriesPerFile = flag.Int("harentriesperfile", 200, "Number of max number of har entries to store in each file")
|
||||||
|
|
||||||
var reqResMatcher = createResponseRequestMatcher() // global
|
var reqResMatcher = createResponseRequestMatcher() // global
|
||||||
var statsTracker = StatsTracker{}
|
var statsTracker = StatsTracker{}
|
||||||
|
|
||||||
// global
|
// global
|
||||||
|
@ -9,8 +9,8 @@ type AppStats struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type StatsTracker struct {
|
type StatsTracker struct {
|
||||||
stats AppStats
|
stats AppStats
|
||||||
statsMutex sync.Mutex
|
statsMutex sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func (st *StatsTracker) incMatchedMessages() {
|
func (st *StatsTracker) incMatchedMessages() {
|
||||||
|
Loading…
Reference in New Issue
Block a user