[macruby-changes] [4282] ControlTower/trunk/lib/control_tower/rack_socket.rb
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jun 25 14:34:31 PDT 2010
Revision: 4282
http://trac.macosforge.org/projects/ruby/changeset/4282
Author: joshua.ballanco at apple.com
Date: 2010-06-25 14:34:30 -0700 (Fri, 25 Jun 2010)
Log Message:
-----------
Better error handling and cleanup.
Modified Paths:
--------------
ControlTower/trunk/lib/control_tower/rack_socket.rb
Modified: ControlTower/trunk/lib/control_tower/rack_socket.rb
===================================================================
--- ControlTower/trunk/lib/control_tower/rack_socket.rb 2010-06-25 21:34:29 UTC (rev 4281)
+++ ControlTower/trunk/lib/control_tower/rack_socket.rb 2010-06-25 21:34:30 UTC (rev 4282)
@@ -38,15 +38,16 @@
response_data.each do |chunk|
connection.write chunk
end
+ else
+ $stderr.puts "Error: No request data receieved!"
end
- rescue EOFError, Errno::ECONNRESET, Errno::EPIPE, Errno::EINVAL, Errno::EBADF
- connection.close rescue nil
- rescue Errno::EMFILE
- # TODO: Need to do something about the dispatch queue...a group wait, maybe? or a dispatch semaphore?
+ rescue EOFError, Errno::ECONNRESET, Errno::EPIPE, Errno::EINVAL
+ $stderr.puts "Error: Connection terminated!"
rescue Object => e
- $stderr.puts "Error receiving data: #{e.inspect}"
+ $stderr.puts "Error: Problem transmitting data -- #{e.inspect}"
ensure
- # TODO: Keep-Alive might be nice, but not yet
+ # We should clean up after our tempfile, if we used one.
+ unlink env['rack.input'] if env['rack.input'].class == Tempfile
connection.close rescue nil
end
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100625/75724464/attachment.html>
More information about the macruby-changes
mailing list