Skip to content

Commit

Permalink
mark policy as deprecated and fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kmala authored and pires committed Jun 28, 2024
1 parent f5e61e7 commit b718e7c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ var DefaultReadHeaderTimeout = 10 * time.Second
// Only one of Policy or ConnPolicy should be provided. If both are provided then
// a panic would occur during accept.
type Listener struct {
Listener net.Listener
Listener net.Listener
// Deprecated: use ConnPolicyFunc instead. This will be removed in future release.
Policy PolicyFunc
ConnPolicy ConnPolicyFunc
ValidateHeader Validator
Expand Down
9 changes: 8 additions & 1 deletion protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,14 @@ func TestPanicIfPolicyAndConnPolicySet(t *testing.T) {
fmt.Printf("accept did panic as expected with error, %v", r)
}
}()
pl.Accept()
conn, err := pl.Accept()
if err != nil {
t.Fatalf("Expected the accept to panic but did not and error is returned, got %v", err)
}

if conn != nil {
t.Fatalf("xpected the accept to panic but did not, got %v", conn)
}
t.Fatalf("expected the accept to panic but did not")
}

Expand Down

0 comments on commit b718e7c

Please sign in to comment.