New plugin: loop (#1989)

* New plugin: loop

Add a plugin that detects loops. It does this by sending an unique query
to our selves. If we see the query more than twice we stop the process.
If there isn't a loop, the plugin disables it self and becomes a noop
plugin.

Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
Miek Gieben 2018-07-20 19:45:17 +01:00 committed by GitHub
parent 547f155465
commit 84ec780ffc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 272 additions and 0 deletions

11
plugin/loop/loop_test.go Normal file
View file

@ -0,0 +1,11 @@
package loop
import "testing"
func TestLoop(t *testing.T) {
l := New(".")
l.inc()
if l.seen() != 1 {
t.Errorf("Failed to inc loop, expected %d, got %d", 1, l.seen())
}
}