Skip to content

Commit

Permalink
ffi experiment. it works, but ctrl-c is no better
Browse files Browse the repository at this point in the history
  • Loading branch information
darkhelmet committed Oct 24, 2010
1 parent cb94082 commit 8d6ac0a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Gemfile
@@ -1,7 +1,8 @@
source 'http://rubygems.org'

gem 'yajl-ruby', '~> 0.7.8', :require => 'yajl'
gem 'zmq', '~> 2.0.9'
gem 'ffi', '~> 0.6.3'
gem 'ffi-rzmq', '~> 0.6.0'

group :development do
gem 'jeweler', '~> 1.4.0'
Expand Down
8 changes: 6 additions & 2 deletions Gemfile.lock
Expand Up @@ -2,13 +2,17 @@ GEM
remote: http://rubygems.org/
specs:
diff-lcs (1.1.2)
ffi (0.6.3)
rake (>= 0.8.7)
ffi-rzmq (0.6.0)
gemcutter (0.6.1)
git (1.2.5)
jeweler (1.4.0)
gemcutter (>= 0.1.0)
git (>= 1.2.5)
rubyforge (>= 2.0.0)
json_pure (1.4.6)
rake (0.8.7)
rspec (2.0.1)
rspec-core (~> 2.0.1)
rspec-expectations (~> 2.0.1)
Expand All @@ -23,14 +27,14 @@ GEM
json_pure (>= 1.1.7)
yajl-ruby (0.7.8)
yard (0.6.1)
zmq (2.0.9)

PLATFORMS
ruby

DEPENDENCIES
ffi (~> 0.6.3)
ffi-rzmq (~> 0.6.0)
jeweler (~> 1.4.0)
rspec (~> 2.0.1)
yajl-ruby (~> 0.7.8)
yard (~> 0.6.1)
zmq (~> 2.0.9)
4 changes: 2 additions & 2 deletions lib/mongrel2/connection.rb
@@ -1,4 +1,4 @@
require 'zmq'
require 'ffi-rzmq'
require 'mongrel2/request'
require 'mongrel2/response'

Expand All @@ -20,7 +20,7 @@ def initialize(uuid, sub, pub, block = true)
end

def recv
msg = @reqs.recv(@block ? 0 : ZMQ::NOBLOCK)
msg = @reqs.recv_string(@block ? 0 : ZMQ::NOBLOCK)
msg.nil? ? nil : Request.parse(msg)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/mongrel2/response.rb
Expand Up @@ -54,7 +54,7 @@ def send_http(req, body, status, headers)
private

def send_resp(uuid, conn_id, data)
@resp.send('%s %d:%s, %s' % [uuid, conn_id.size, conn_id, data])
@resp.send_string('%s %d:%s, %s' % [uuid, conn_id.size, conn_id, data])
end

def build_http_response(body, status, headers)
Expand Down

0 comments on commit 8d6ac0a

Please sign in to comment.