Skip to content

Commit

Permalink
Some minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
evanphx committed Jul 24, 2012
1 parent 9844daa commit 44c8c1a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 2 additions & 0 deletions lib/puma/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def close
@io.close
end

# The object used for a request with no body. All requests with
# no body share this one object since it has no state.
EmptyBody = NullIO.new

def setup_body
Expand Down
7 changes: 4 additions & 3 deletions lib/puma/reactor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ module Puma
class Reactor
DefaultSleepFor = 5

def initialize(events, app_pool)
@events = events
def initialize(server, app_pool)
@server = server
@events = server.events
@app_pool = app_pool

@mutex = Mutex.new
Expand Down Expand Up @@ -35,7 +36,7 @@ def run
end
# The client doesn't know HTTP well
rescue HttpParserError => e
@events.parse_error self, c.env, e
@events.parse_error @server, c.env, e

rescue EOFError
c.close
Expand Down
4 changes: 0 additions & 4 deletions lib/puma/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,6 @@ def normalize_env(env, client)
env[REMOTE_ADDR] = client.peeraddr.last
end

# The object used for a request with no body. All requests with
# no body share this one object since it has no state.
EmptyBody = NullIO.new

# Given the request +env+ from +client+ and a partial request body
# in +body+, finish reading the body if there is one and invoke
# the rack app. Then construct the response and write it back to
Expand Down

0 comments on commit 44c8c1a

Please sign in to comment.