Permalink
Browse files

Add documentation for 'connected' method

  • Loading branch information...
1 parent c553601 commit b10d2dc671a6ef76fca2a77c4e08d1fe37da96dd luben committed Jul 13, 2011
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/Feersum/Connection/Handle.pm
@@ -57,6 +57,8 @@ For write handles:
$w->poll_cb(sub {
# use $_[0] instead of $w to avoid a closure
$_[0]->write(\"some data");
+ # check if the socket is connected
+ $_[0]->connected();
# can close() or unregister the poll_cb in here
$_[0]->close();
});
@@ -138,6 +140,13 @@ Pass in an array-ref and it works much like the two C<write()> calls above,
except it's way more efficient than calling C<write()> over and over.
Undefined elements of the array are ignored.
+=item C<< $w->connected() >>
+
+Uses getpeername in order to determine if the underlying socket is connected.
+It will return true even if the socket is in CLOSE_WAIT state. If the TCP
+socket is closed (after TCP timeout) by the system it will return false
+value. The implementations is consistent with IO::Handle.
+
=item C<< $w->close() >>
Close the HTTP response (which triggers the "T-E: chunked" terminating chunk

0 comments on commit b10d2dc

Please sign in to comment.