diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-10-25 22:15:47 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-10-25 22:15:47 +0000 |
commit | 894cb73887c106acc793f0317ee849ae215ead56 (patch) | |
tree | 9f4f4d8caff831383a46dc4eb05e71b32c6ee628 /lib/rainbows/error.rb | |
parent | 4ee6e0dafeb1b7af28fa90ae27c1a1a04aa8e852 (diff) | |
download | rainbows-894cb73887c106acc793f0317ee849ae215ead56.tar.gz |
kgio_trywrite is superior if it is available.
Diffstat (limited to 'lib/rainbows/error.rb')
-rw-r--r-- | lib/rainbows/error.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/rainbows/error.rb b/lib/rainbows/error.rb index bdbfdc5..68cdec4 100644 --- a/lib/rainbows/error.rb +++ b/lib/rainbows/error.rb @@ -9,7 +9,13 @@ module Rainbows::Error # if the socket is already closed or broken. We'll always ensure # the socket is closed at the end of this function def self.write(io, e) - msg = response(e) and io.write_nonblock(msg) + if msg = response(e) + if io.respond_to?(:kgio_trywrite) + io.kgio_trywrite(msg) + else + io.write_nonblock(msg) + end + end rescue end |