refactor backend socket/connection handling
commit60c22ca86f8fcea8b51c90d5cb759cc2f29cac59
authorEric Wong <normalperson@yhbt.net>
Thu, 13 Jan 2011 01:49:32 +0000 (12 17:49 -0800)
committerEric Wong <normalperson@yhbt.net>
Thu, 13 Jan 2011 01:49:32 +0000 (12 17:49 -0800)
treebc355b6d3325b58825c67a60c45b33090590882a
parent79718dd2b5d7fa05974388d409dec44a298ebefe
refactor backend socket/connection handling

We now take steps to ensure the socket we wrote to is always the same as
the socket we'll read from.  And if a read ever fails we'll close the
socket to avoid having responses.  We've also switched from Socket#send
to IO#write as IO#write guarantees write-in-full behavior as long as the
socket is alive (MogileFS queries are small)

The public MogileFS::Backend#shutdown method is now thread-safe,
too.
lib/mogilefs/backend.rb
test/test_backend.rb