ChangeLog from git://git.bogomips.org/kgio.git () commit f4d08a07a02393cca5ddd1277acc4f95c83307ff Author: Eric Wong Date: Fri Oct 8 14:55:16 2010 -0700 kgio 1.3.1 - fix zero-length reads kgio_read and kgio_tryread will now return an empty string when a length of zero is specified instead of nil (which would signal an EOF). This emulates the behavior of IO#read, IO#readpartial, IO#sysread, IO#read_nonblock in core Ruby for consistency. commit d225ede82d820d045bd7cfb826f444cf6601577c Author: Eric Wong Date: Fri Oct 8 02:53:38 2010 -0700 return empty string on length=0 This matches behavior of all the core Ruby methods. commit e4599227f0da0f652cbcb52838e631d7384dcd0d Author: Eric Wong Date: Thu Oct 7 20:02:40 2010 -0700 kgio 1.3.0 - bug and usability fixes * make Kgio::WaitWritable and Kgio::WaitReadable symbols * trywrite: fix stupid off-by-one error causing corrupt writes on retries commit f5fc35221d37141b0f72278c7b969211410e94c0 Author: Eric Wong Date: Thu Oct 7 20:00:09 2010 -0700 tests: don't trust what I think I know about Ruby case/when and === didn't actually work as I expected them to. commit 2152188f41bf2a5067e84a4404b48b2282a9dd55 Author: Eric Wong Date: Thu Oct 7 19:56:57 2010 -0700 trywrite: fix stupid off-by-one error causing corrupt writes Oops! commit c448ad898ecb7f354a32a320294da4727fc9af52 Author: Eric Wong Date: Thu Oct 7 19:55:49 2010 -0700 make WaitWritable and WaitReadable symbols This makes them easier to compare with === when used in case/when statements in Ruby commit 49f0b98c69f1f0bf637953d0bfc96b764f00ab9b Author: Eric Wong Date: Thu Oct 7 07:15:49 2010 +0000 kgio 1.2.1 - doc and *BSD workarounds This fixes our accept4() wrapper which did not work as expected on some *BSD-based systems due to fcntl(fd, F_GETFL) returning false information. Linux 2.6+ users are unnaffected, including those without accept4(). Also some RDoc fixes. commit 03344bb763f5269afe7fafd56a47270719c7ef9e Author: Eric Wong Date: Thu Oct 7 07:14:07 2010 +0000 doc: fix RDoc generation Oops, completely broken by the splitting of the code. commit 637317eb479525dca543eda7a8977410bc43b832 Author: Eric Wong Date: Wed Oct 6 14:08:35 2010 -0700 accept4: workaround (P)OS X bug w/O_NONBLOCK Apparently fcntl(fd, F_GETFL) can return falsely return the O_NONBLOCK flag without actually having it set in the kernel. This is totally broken on the part of the OS. commit ca76c75f8a24d0cd6828fe16ca3790a277b35f8d Author: Eric Wong Date: Wed Oct 6 14:06:27 2010 -0700 build: pick on on modified extension files We build more than one file nowadays. commit 65f96b7750616bc210397c16eea40961e578a788 Author: Eric Wong Date: Wed Oct 6 11:51:04 2010 -0700 doc: fix typo in Kgio.accept_cloexec= doc oops... commit 414dd17f1009c571e2d7657721271756e3d4dd8e Author: Eric Wong Date: Tue Oct 5 16:09:40 2010 -0700 kgio 1.2.0 - cleanups and minor improvements The C extension is now split into several files for ease-of-maintenance. Slightly more common, client-triggerable exceptions (EOFError, Errno::EPIPE, Errno::ECONNRESET) are now less expensive as they are generated without backtraces. commit e085bb9600b190692beb5efc85656ebf127ae08c Author: Eric Wong Date: Tue Oct 5 15:45:16 2010 -0700 generate empty backtraces for EPIPE and ECONNRESET Malicious clients may disconnect during big writes to cause EPIPE and ECONNRESET exceptions. Generating backtraces can be expensive with Ruby, so mitigate the DoS vector by lowering the cost of generating an exception. commit b168cc894037620cab82fa82f3ab37a3aab81570 Author: Eric Wong Date: Tue Oct 5 15:26:57 2010 -0700 add kgio_read! methods which may raise EOFError Except EOFError is gently raised to not include a huge backtrace. Large backtraces can be a performance problem on busy servers that malicious clients may exploit to deny service. commit 870ada92db7071c7982913e508ac35b97d6e8761 Author: Eric Wong Date: Tue Oct 5 11:45:02 2010 -0700 GNUmakefile: use portable tar invocation We've been spoiled by GNU tar. commit 2a6115a89d5c95428bd6c3e0bc10e5a3a4c3c3be Author: Eric Wong Date: Wed Sep 29 18:25:58 2010 -0700 refactor and split into separate files Making the code easier to read and navigate. This also frees us from having to use the stupid A4_ prefix for accept4(2) flags since it conflicts with the socket(2) ones. commit 8fe89997453d6c530c3f5e08bc9c1da40a621248 Author: Eric Wong Date: Wed Sep 29 17:13:21 2010 -0700 Make kgio_trywrite more aggressive with retrying Partial writes can be retried until completely denied with EAGAIN. Often times, it is beneficial to retry immediately after a partial write because the kernel may allocate more buffers or the reader can drain the buffers. This helps the caller avoid crossing the Ruby <-> C boundary more than necessary. commit 39c851e595970a2349a8a39878afd94a3324e102 Author: Eric Wong Date: Tue Sep 28 18:16:53 2010 -0700 kgio 1.1.0 - flexible accept methods * an alternate class now be returned by accept/tryaccept by setting "Kgio.accept_class =" commit 911f6ab306aff1e24c9c570eeae33923fa1b99d9 Author: Eric Wong Date: Tue Sep 28 18:04:51 2010 -0700 alternate classes may be returned by accept/tryaccept These can be useful for avoiding wrapper objects and also allows users to more easily try different things without stepping on others' toe^H^H^Hclasses. commit 526b4bd48a20a34ef5959fdc4aa580d5f9199652 Author: Eric Wong Date: Mon Sep 27 19:59:34 2010 -0700 kgio 1.0.1 - compatibility fixes * add compatibility for ancient Rubies (1.8.6) * linux: fix accept4() support for newer Linux commit 20cbc0355104470fb433dd13e87a5d5c7e888ab1 Author: Eric Wong Date: Tue Sep 28 02:56:41 2010 +0000 linux: fix accept4() support for newer Linux Oops :x Tested on Debian sid. commit 24f1d168eb0937f0586c45b266bcd208431f0107 Author: Eric Wong Date: Mon Sep 27 18:06:34 2010 -0700 add compatibility for ancient Rubies This is tested on Ruby 1.8.6-p114, but may work for 1.8.5, too. Ugh, people ought to upgrade. commit e4d204c86e9420023ba3e4d8dbeb6b3fea8d6cf7 Author: Eric Wong Date: Tue Sep 28 00:27:44 2010 +0000 kgio 1.0.0 - initial release Documentation and release infrastructure updates and such... commit 8984b9556a3493570fbb4f747fce712d58f2cdd8 Author: Eric Wong Date: Tue Sep 28 00:07:43 2010 +0000 doc: TODO update commit 2c64a1fc07d3b9a80d112e3b0e2baa7ec29c2f47 Author: Eric Wong Date: Tue Sep 28 00:03:39 2010 +0000 read/write: account for buffer changes during wait It's possible for applications to modify the buffer during reads and writes, so make a best effort to account for those. commit f2ea9918655e8ee0576bee2950d16485031fc361 Author: Eric Wong Date: Mon Sep 27 23:59:59 2010 +0000 tests: fix broken monster trywrite test Oops, use random data so it's easier to detect this. commit 7abc0eb3dd804c2e65660b7dd9c828df0e03b80a Author: Eric Wong Date: Mon Sep 27 15:09:44 2010 -0700 test_tcp*read_write: use blocking kgio_accept in setup Some OSes (FreeBSD 7.0) do not seem to setup connections as quickly. commit 95d2eae6a4da34c504427af6ae0ab4c8c70c0ce5 Author: Eric Wong Date: Mon Sep 27 15:09:43 2010 -0700 set blocking flag before blocking IO#read Some older Rubies may not behave correctly otherwise commit 0806cac89f9d0e169b6c1e4da68c1ad66daa23ae Author: Eric Wong Date: Mon Sep 27 23:16:53 2010 +0000 tess: ensure buffer is cleared on failures No need to leak data. commit 50b86bf23063f3e6c3777b39c9464f73ccfd6ef5 Author: Eric Wong Date: Mon Sep 27 22:55:52 2010 +0000 more documentation Somebody's gotta do it... commit 5123d66fe0b2dad67539a20fe5b91f5b9afd814a Author: Eric Wong Date: Mon Sep 27 16:56:13 2010 +0000 avoid initiating syscalls before rb_io_wait_* Some Ruby implementations (Rubinius) may call lseek and clobber the intended errno when looking up the open file, causing rb_io_wait_* functions to fail. commit 6c818b0b6f76ef733679bcea1024142b4ef3ce00 Author: Eric Wong Date: Mon Sep 27 01:13:30 2010 +0000 add kgio_tryaccept, kgio_accept _really_ blocks We'll stick with the "try" prefix if we're going to be non-blocking. kgio_accept will favor a blocking accept() call where it's possible to release the GVL, allowing it to avoid thundering herd problems. Otherwise it'll use thread-safe blocking under Ruby 1.8. commit f81cb3c05a0eb46ec61ceb295b51ead16e6a0da4 Author: Eric Wong Date: Mon Sep 27 00:57:14 2010 +0000 use SOCK_NONBLOCK for socket(2) if possible This saves us a relatively expensive fcntl() system call. commit 87cf3ce6185b9138032a5af53cecae98f8c93564 Author: Eric Wong Date: Mon Sep 27 00:24:50 2010 +0000 connect: no do not leak descriptors on failure We cannot raise exceptions and expect GC to clean up after us until we've created an actual IO object. commit 6fbde1518578dd1b828efcecaf2caf893bddc110 Author: Eric Wong Date: Mon Sep 27 00:11:43 2010 +0000 "start" singleton methods for non-blocking connect These initiate (but do not wait for) non-blocking connects. commit fdfecc6d815bab8dfc1d8ad6758a66d44ab51e31 Author: Eric Wong Date: Sun Sep 26 07:51:12 2010 +0000 introduce kgio_try* methods Avoid altering behavior based on globals that Kgio.wait_{read,writ}able stored in, since that's too confusing. The non-try variants are closer to the normal IO read/write methods, except they can be more easily plugged into alternate reactors and event frameworks. commit d8ee79e1e5c6e6908009213324db25cf41c583ce Author: Eric Wong Date: Sat Sep 25 17:55:07 2010 +0000 kgio_read returns nil on EOF Just like IO#read commit af03e4471de3d3b91eec16e26e93a84d4a717116 Author: Eric Wong Date: Sat Sep 25 17:47:13 2010 +0000 split out reusable bits into separate headers No point in cluttering up the meat of our code. commit db53263856d864ba6273e6cac73011f699509d71 Author: Eric Wong Date: Sat Sep 25 01:36:13 2010 -0700 only use MSG_DONTWAIT under Linux MSG_DONTWAIT is less consistently implemented/supported on other platforms on stream sockets, so fallback to fcntl() + read()/write() for stream sockets. This also fixes our previously broken support of non-MSG_DONTWAIT systems. commit a82dc40c2a509c4ab692da34b572693f243fbfae Author: Eric Wong Date: Sat Sep 25 01:36:12 2010 -0700 write/send may fail with ECONNRESET Tested on FreeBSD 7.0 commit 0c60192621303f5e4ebd46d43a058de48126bc8a Author: Eric Wong Date: Sat Sep 25 01:36:11 2010 -0700 fix missing netinet/in.h include This is needed for FreeBSD 7.0, at least. commit 0beb82437f4ab0b8422e225080b234361092315e Author: Eric Wong Date: Sat Sep 25 08:15:13 2010 +0000 beef up the test suite We need to test server <-> client interaction more thoroughly since some systems don't implement everything right. commit 460e6b025896dee64b39d194d4c1a536129654de Author: Eric Wong Date: Thu Sep 23 22:56:44 2010 +0000 initial commit + release everything shou^Wmight be working...