Skip to content

Commit b718e7c

Browse files
kmalapires
authored andcommitted
mark policy as deprecated and fix lint
1 parent f5e61e7 commit b718e7c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

protocol.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ var DefaultReadHeaderTimeout = 10 * time.Second
2626
// Only one of Policy or ConnPolicy should be provided. If both are provided then
2727
// a panic would occur during accept.
2828
type Listener struct {
29-
Listener net.Listener
29+
Listener net.Listener
30+
// Deprecated: use ConnPolicyFunc instead. This will be removed in future release.
3031
Policy PolicyFunc
3132
ConnPolicy ConnPolicyFunc
3233
ValidateHeader Validator

protocol_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,14 @@ func TestPanicIfPolicyAndConnPolicySet(t *testing.T) {
703703
fmt.Printf("accept did panic as expected with error, %v", r)
704704
}
705705
}()
706-
pl.Accept()
706+
conn, err := pl.Accept()
707+
if err != nil {
708+
t.Fatalf("Expected the accept to panic but did not and error is returned, got %v", err)
709+
}
710+
711+
if conn != nil {
712+
t.Fatalf("xpected the accept to panic but did not, got %v", conn)
713+
}
707714
t.Fatalf("expected the accept to panic but did not")
708715
}
709716

0 commit comments

Comments
 (0)