func (l *Listener) disconnect(gattconn gatt.Conn) { log.Println("Disconnected:", gattconn.RemoteAddr()) if gattconn.RemoteAddr().String() == l.conn.gattconn.RemoteAddr().String() { l.conn.Close() } l.conn = nil }
func (l *Listener) connect(gattconn gatt.Conn) { log.Println("New connection from", gattconn.RemoteAddr()) defer func() { recover() }() // don't panic if l.connc is closed l.addr = gattconn.LocalAddr() l.connc <- newConn(gattconn) }