Files
weave-scope/probe/endpoint/procspy/fixture.go
Matthias Radestock 59f777a066 don't read all of /proc when probe.proc.spy=false
Previously we were doing the reading even though we weren't looking at
the result.
2017-06-02 14:01:25 +01:00

28 lines
587 B
Go

package procspy
type fixedConnIter []Connection
func (f *fixedConnIter) Next() *Connection {
if len(*f) == 0 {
return nil
}
car := (*f)[0]
*f = (*f)[1:]
return &car
}
// FixedScanner implements ConnectionScanner and uses constant Connection and
// ConnectionProcs.
type FixedScanner []Connection
// Connections implements ConnectionsScanner.Connections
func (s FixedScanner) Connections() (ConnIter, error) {
iter := fixedConnIter(s)
return &iter, nil
}
// Stop implements ConnectionsScanner.Stop (dummy since there is no background work)
func (s FixedScanner) Stop() {}