The destructor now calls Shutdown (which now also calls close).

http://codereview.chromium.org/42387/diff/1008/1012
File src/platform-linux.cc (right):

http://codereview.chromium.org/42387/diff/1008/1012#newcode671
Line 671: bool IsValid() const { return socket_ != -1; }
On 2009/03/19 11:31:41, Erik Corry wrote:
> Seems like this never fails since socket_ is never set to -1 any more.
  The only
> case is if the initial socket creation failed.

Shutdown now invalidates the socket_ member.

http://codereview.chromium.org/42387/diff/1008/1012#newcode744
Line 744: if (IsValid()) {
On 2009/03/19 11:31:41, Erik Corry wrote:
> You don't want to call shutdown on a socket that failed to open, but
you don't
> mind calling it twice on a socket that was open once.  That seems
inconsistent.

Added a call to close in here as well and set socket_ to -1 (not valid).
Also call Shutdown in the destructor instead of close. After a call to
Shutdown the Socket object is unusable for any communication.

http://codereview.chromium.org/42387/diff/1008/1014
File src/platform.h (right):

http://codereview.chromium.org/42387/diff/1008/1014#newcode442
Line 442: // Shutdown socket for both read and write.
On 2009/03/19 11:31:41, Erik Corry wrote:
> Needs a comment along the lines of: This wakes up threads and
processes blocked
> on a read or write of the socket.

Done.

http://codereview.chromium.org/42387

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to