Skip to content

Commit a798a48

Browse files
Raif Gabdullindeadprogram
Raif Gabdullin
authored andcommitted
Issue #311 Clean resources properly when disable notifications
1 parent 5cc5c45 commit a798a48

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

gattc_linux.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func (c DeviceCharacteristic) WriteWithoutResponse(p []byte) (n int, err error)
235235
// changes.
236236
//
237237
// Users may call EnableNotifications with a nil callback to disable notifications.
238-
func (c DeviceCharacteristic) EnableNotifications(callback func(buf []byte)) error {
238+
func (c *DeviceCharacteristic) EnableNotifications(callback func(buf []byte)) error {
239239
switch callback {
240240
default:
241241
if c.property != nil {
@@ -280,6 +280,7 @@ func (c DeviceCharacteristic) EnableNotifications(callback func(buf []byte)) err
280280

281281
err := c.adapter.bus.RemoveMatchSignal(c.propertiesChangedMatchOption)
282282
c.adapter.bus.RemoveSignal(c.property)
283+
close(c.property)
283284
c.property = nil
284285
return err
285286
}

0 commit comments

Comments
 (0)