Skip to content

Commit

Permalink
refactor: returns receive-only channel to prevent closing it from the…
Browse files Browse the repository at this point in the history
… caller go-ldap#319
  • Loading branch information
t2y committed Jun 4, 2023
1 parent 60bc080 commit 03e1d76
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion search.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ func (l *Conn) Search(searchRequest *SearchRequest) (*SearchResult, error) {
// all results until an error happens (or the search successfully finished),
// e.g. for size / time limited requests all are recieved via the channel
// until the limit is reached.
func (l *Conn) SearchWithChannel(ctx context.Context, searchRequest *SearchRequest) chan *SearchSingleResult {
func (l *Conn) SearchWithChannel(ctx context.Context, searchRequest *SearchRequest) <-chan *SearchSingleResult {
ch := make(chan *SearchSingleResult)
go func() {
defer close(ch)
Expand Down
2 changes: 1 addition & 1 deletion v3/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ func (l *Conn) Search(searchRequest *SearchRequest) (*SearchResult, error) {
// all results until an error happens (or the search successfully finished),
// e.g. for size / time limited requests all are recieved via the channel
// until the limit is reached.
func (l *Conn) SearchWithChannel(ctx context.Context, searchRequest *SearchRequest) chan *SearchSingleResult {
func (l *Conn) SearchWithChannel(ctx context.Context, searchRequest *SearchRequest) <-chan *SearchSingleResult {
ch := make(chan *SearchSingleResult)
go func() {
defer close(ch)
Expand Down

0 comments on commit 03e1d76

Please sign in to comment.