Skip to content

Commit

Permalink
Catch all client errors for clean recovery; log adding/removing clients
Browse files Browse the repository at this point in the history
  • Loading branch information
daBrado committed Aug 26, 2013
1 parent cec7fe4 commit 4c9425c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4c9425c

Please sign in to comment.