Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cleanup

  • Loading branch information...
commit f11048bad51daa9d7e3a20d4bb7889328269808e 1 parent 6a3b4cd
Jonathan Rudenberg authored
View
1  examples/benchmark.rb
@@ -34,7 +34,6 @@
puts "benchmark finished in #{ms}s"
exit 0
-
end
end
View
1  examples/em_client.rb
@@ -1,4 +1,3 @@
-
$:.unshift File.join(File.dirname(__FILE__), '../lib')
require 'messagepipe/client'
require 'messagepipe/transport/eventmachine'
View
40 lib/messagepipe/server.rb
@@ -17,30 +17,28 @@ def pac
def receive_data(data)
pac.feed(data)
pac.each do |msg|
- begin
- response = nil
-
- secs = Benchmark.realtime do
- type = msg[0]
- seqid = msg[1]
-
- if type != REQUEST
- unbind
- raise 'Bad client'
- end
-
- # message format: [type, seqid, error_object, result_object]
- response = begin
- [RESPONSE, seqid, nil, receive_object(msg[2,2])]
- rescue => e
- [RESPONSE, seqid, "#{e.class.name}: #{e.message}", nil]
- end
- end
+ response = nil
+
+ secs = Benchmark.realtime do
+ type = msg[0]
+ seqid = msg[1]
- send_data(response.to_msgpack)
+ if type != REQUEST
+ unbind
+ raise 'Bad client'
+ end
- puts "#{object_id} - #{msg[1]} - #{msg[2]}(#{msg[3].length} args) - [%.4f ms] [#{response[2] ? 'error' : 'ok'}]" % [secs||0]
+ # message format: [type, seqid, error_object, result_object]
+ response = begin
+ [RESPONSE, seqid, nil, receive_object(msg[2,2])]
+ rescue => e
+ [RESPONSE, seqid, "#{e.class.name}: #{e.message}", nil]
+ end
end
+
+ send_data(response.to_msgpack)
+
+ puts "#{object_id} - #{msg[1]} - #{msg[2]}(#{msg[3].length} args) - [%.4f ms] [#{response[2] ? 'error' : 'ok'}]" % [secs||0]
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.