drbrain / net-http-persistent

Thread-safe persistent connections with Net::HTTP
http://seattlerb.rubyforge.org/net-http-persistent
339 stars 117 forks source link

Support more socket options (useful for SO_KEEPALIVE, etc) #2

Closed raggi closed 13 years ago

raggi commented 13 years ago

In the spirit of the one tenderlove, here's a video:

http://www.youtube.com/watch?v=ie7IIAufMzI

And here's a patch for custom setsockopt options, with a test and a refactor.

<3
drbrain commented 13 years ago

I decided to implement this a different way such that multiple socket options can be set.

http.socket_options << [Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, 1]

Will do what you want.

raggi commented 13 years ago

i, err, only see a difference in method name. thanks!

raggi commented 13 years ago

Oh, wait, why not just use http.sockopts.concat Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, 1 ?

raggi commented 13 years ago

Sorry for the noise, I see what you're up to... Yeah, my patch was probably broken for some other uses.