Skip to content

Conversation

moogle19
Copy link

see #11

linux/hci/gap.go Outdated
@@ -206,31 +206,39 @@ func (h *HCI) Dial(ctx context.Context, a ble.Addr) (ble.Client, error) {
return nil, err
}
var tmo <-chan time.Time
if h.dialerTmo != time.Duration(0) {
if deadline, ok := ctx.Deadline(); ok {
tmo = time.After(time.Until(deadline))
Copy link

@estutzenberger estutzenberger Mar 14, 2018

Choose a reason for hiding this comment

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

I'm not sure if this is necessary. If the context has a deadline, then it is already effectively a timeout. If the goal is to override the dialer timeout, then I think the select on <-ctx.Done() could be removed since selecting <-tmo is the same thing. Otherwise, I think the changes look great.

Copy link

@estutzenberger estutzenberger left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for working on it.

@moogle19 moogle19 merged commit 1dd6d60 into go-ble:master Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants