Skip to content

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

Merged
cpuschma merged 2 commits intogo-ldap:masterfrom
t2y:refactor-search-async
Apr 1, 2024
Merged

Refactor the context handling with receiving an ldap response in searchAsync()#496
cpuschma merged 2 commits intogo-ldap:masterfrom
t2y:refactor-search-async

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.

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
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.

2 participants