Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the context handling with receiving an ldap response in searchAsync() #496

Merged
merged 2 commits into from Apr 1, 2024

Conversation

t2y
Copy link
Contributor

@t2y t2y commented Apr 1, 2024

@SaschaRoland suggested refactoring context handling in #495. This change enables context-based canceling while receiving an LDAP response.

@@ -102,9 +102,7 @@ func (r *searchResponse) start(ctx context.Context, searchRequest *SearchRequest
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest you move the debug line above the select statement instead of erasing it completely:

foundSearchSingleResultDone := false
for !foundSearchSingleResultDone {
	r.conn.Debug.Printf("%d: waiting for response", msgCtx.id)
	select {
	case <-ctx.Done():...

@cpuschma cpuschma merged commit 87d782b into go-ldap:master Apr 1, 2024
21 checks passed
gustavoluvizotto pushed a commit to gustavoluvizotto/ldap-fork that referenced this pull request Apr 11, 2024
…chAsync() (go-ldap#496)

* Refactor the context handling with receiving an ldap response in searchAsync() go-ldap#495
* Add debug print for response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants