Eric Wong <[email protected]> wrote: > Can some FreeBSD users review this? Thank you. > This issue was reported privately by a FreeBSD 8.1-RELEASE user.
(Original (private) bug reporter Bcc-ed) ref: http://mid.gmane.org/[email protected] > This unfortunately means we won't be able disable TCP_NOPUSH > once turned on (via SIGHUP/SIGUSR2). I think I'll push the following patch instead. Some versions of FreeBSD (or Debian kFreeBSD) have always worked fine with TCP_NOPUSH explicitly set (to 0/1) and I don't want to break the case where somebody wants to disable TCP_NOPUSH once turned on. diff --git a/lib/unicorn/socket_helper.rb b/lib/unicorn/socket_helper.rb index 21c52e3..18b0be7 100644 --- a/lib/unicorn/socket_helper.rb +++ b/lib/unicorn/socket_helper.rb @@ -28,7 +28,7 @@ module Unicorn :backlog => 1024, # favor latency over bandwidth savings - :tcp_nopush => false, + :tcp_nopush => nil, :tcp_nodelay => true, } #:startdoc: @@ -62,12 +62,12 @@ module Unicorn end val = opt[:tcp_nopush] - val = DEFAULTS[:tcp_nopush] if nil == val - val = val ? 1 : 0 - if defined?(TCP_CORK) # Linux - sock.setsockopt(IPPROTO_TCP, TCP_CORK, val) - elsif defined?(TCP_NOPUSH) # TCP_NOPUSH is untested (FreeBSD) - sock.setsockopt(IPPROTO_TCP, TCP_NOPUSH, val) + unless val.nil? + if defined?(TCP_CORK) # Linux + sock.setsockopt(IPPROTO_TCP, TCP_CORK, val) + elsif defined?(TCP_NOPUSH) # TCP_NOPUSH is lightly tested (FreeBSD) + sock.setsockopt(IPPROTO_TCP, TCP_NOPUSH, val) + end end # No good reason to ever have deferred accepts off -- Eric Wong _______________________________________________ Unicorn mailing list - [email protected] http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying
