diff --git a/response.go b/response.go index 1abe02a..0eae100 100644 --- a/response.go +++ b/response.go @@ -98,13 +98,12 @@ func (r *searchResponse) start(ctx context.Context, searchRequest *SearchRequest foundSearchSingleResultDone := false for !foundSearchSingleResultDone { + r.conn.Debug.Printf("%d: waiting for response", msgCtx.id) select { case <-ctx.Done(): r.conn.Debug.Printf("%d: %s", msgCtx.id, ctx.Err().Error()) return - default: - r.conn.Debug.Printf("%d: waiting for response", msgCtx.id) - packetResponse, ok := <-msgCtx.responses + case packetResponse, ok := <-msgCtx.responses: if !ok { err := NewError(ErrorNetwork, errors.New("ldap: response channel closed")) r.ch <- &SearchSingleResult{Error: err} diff --git a/v3/response.go b/v3/response.go index 1abe02a..0eae100 100644 --- a/v3/response.go +++ b/v3/response.go @@ -98,13 +98,12 @@ func (r *searchResponse) start(ctx context.Context, searchRequest *SearchRequest foundSearchSingleResultDone := false for !foundSearchSingleResultDone { + r.conn.Debug.Printf("%d: waiting for response", msgCtx.id) select { case <-ctx.Done(): r.conn.Debug.Printf("%d: %s", msgCtx.id, ctx.Err().Error()) return - default: - r.conn.Debug.Printf("%d: waiting for response", msgCtx.id) - packetResponse, ok := <-msgCtx.responses + case packetResponse, ok := <-msgCtx.responses: if !ok { err := NewError(ErrorNetwork, errors.New("ldap: response channel closed")) r.ch <- &SearchSingleResult{Error: err}