From 4c9425c920883c96ac5bf7d68689dced38443784 Mon Sep 17 00:00:00 2001 From: Braden Date: Mon, 26 Aug 2013 08:27:13 -0700 Subject: [PATCH] Catch all client errors for clean recovery; log adding/removing clients --- lib/server.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/server.rb b/lib/server.rb index f2b2c25..0a92334 100644 --- a/lib/server.rb +++ b/lib/server.rb @@ -15,12 +15,14 @@ def start while socket = @unix_server.accept do client = Client.new @bridge, socket Thread.new do + IRCNotify.log "Adding client #{client}" @mutex.synchronize { @clients << client } begin client.start_read - rescue StandardError => error + rescue => error IRCNotify.log "Client error: #{error}", :error end + IRCNotify.log "Removing client #{client}" @mutex.synchronize { @clients.delete client } end end