Skip to content

Commit d08d737

Browse files
committed
fix(device/base): remove stop, use shutdown!
1 parent 431ba6f commit d08d737

4 files changed

Lines changed: 8 additions & 12 deletions

File tree

examples/matter_bridge_device.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ module MatterBridge
597597
return unless confirmation && confirmation.strip.downcase == "yes"
598598

599599
puts "Performing factory reset..."
600-
stop
600+
shutdown!
601601
File.delete(STORAGE_FILE) if File.exists?(STORAGE_FILE)
602602
puts "Factory reset complete"
603603
puts "Please restart the application"

examples/matter_level_control_device.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ module MatterLevelControl
344344
return unless confirmation && confirmation.strip.downcase == "yes"
345345

346346
puts "Performing factory reset..."
347-
stop
347+
shutdown!
348348
File.delete(STORAGE_FILE) if File.exists?(STORAGE_FILE)
349349
puts "Factory reset complete."
350350
puts "Please restart the application."

examples/matter_switch_device.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ module MatterSwitch
290290
return unless confirmation && confirmation.strip.downcase == "yes"
291291

292292
puts "🔄 Performing factory reset..."
293-
stop
293+
shutdown!
294294
File.delete(STORAGE_FILE) if File.exists?(STORAGE_FILE)
295295
puts "✅ Factory reset complete"
296296
puts "🔄 Please restart the application"

src/matter/device/base.cr

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,6 @@ module Matter
153153
# Signals shutdown, stops all services, and unblocks all `await_shutdown` waiters.
154154
# Safe to call from signal handlers or other fibers.
155155
def shutdown! : Nil
156-
stop
157-
on_shutdown
158-
rescue error
159-
Log.error(exception: error) { "error performing shutdown" }
160-
ensure
161-
@shutdown_channel.close
162-
end
163-
164-
def stop : Nil
165156
# Persist all session state before shutdown to ensure message counters
166157
# and other session data are saved for clean reconnection after restart
167158
@message_handler.persist_all_sessions
@@ -172,6 +163,11 @@ module Matter
172163
@storage_manager.stop
173164
@transport.close
174165
@responder.stop
166+
on_shutdown
167+
rescue error
168+
Log.error(exception: error) { "error performing shutdown" }
169+
ensure
170+
@shutdown_channel.close
175171
end
176172

177173
# ------------------------------------------------------------------------

0 commit comments

Comments
 (0)