From 07b64755b203d9c99a59ae69e3155103d4cfefc5 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 26 May 2019 22:15:44 +0000 Subject: remove kgio from all read(2) and write(2) wrappers It's fairly easy given unicorn was designed with synchronous I/O in mind. The overhead of backtraces from EOFError on readpartial should be rare given our requirement to only accept requests from fast, reliable clients on LAN (e.g. nginx or yet-another-horribly-named-server). --- lib/unicorn/worker.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/unicorn/worker.rb') diff --git a/lib/unicorn/worker.rb b/lib/unicorn/worker.rb index 5ddf379..ad5814c 100644 --- a/lib/unicorn/worker.rb +++ b/lib/unicorn/worker.rb @@ -65,7 +65,7 @@ class Unicorn::Worker end # writing and reading 4 bytes on a pipe is atomic on all POSIX platforms # Do not care in the odd case the buffer is full, here. - @master.kgio_trywrite([signum].pack('l')) + @master.write_nonblock([signum].pack('l'), exception: false) rescue Errno::EPIPE # worker will be reaped soon end @@ -73,7 +73,7 @@ class Unicorn::Worker # this only runs when the Rack app.call is not running # act like a listener def kgio_tryaccept # :nodoc: - case buf = @to_io.kgio_tryread(4) + case buf = @to_io.read_nonblock(4, exception: false) when String # unpack the buffer and trigger the signal handler signum = buf.unpack('l') -- cgit v1.2.3-24-ge0c7