Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Issue 42387: Change the socket close to shutdown (Closed)

Created:
11 years, 9 months ago by Søren Thygesen Gjesse
Modified:
9 years, 7 months ago
Reviewers:
Erik Corry
CC:
v8-dev
Visibility:
Public.

Description

Change the socket close to shutdown. Removed the close method for socket and added shutdown instead. The shutdown method is the one to use when terminating socket communication. The close call is in the destructor. Committed: http://code.google.com/p/v8/source/detail?r=1545

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 6

Patch Set 4 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+35 lines, -33 lines) Patch
M src/platform.h View 1 2 3 1 chunk +4 lines, -2 lines 0 comments Download
M src/platform-freebsd.cc View 1 2 3 3 chunks +8 lines, -7 lines 0 comments Download
M src/platform-linux.cc View 1 2 3 3 chunks +7 lines, -7 lines 0 comments Download
M src/platform-macos.cc View 1 2 3 3 chunks +7 lines, -7 lines 0 comments Download
M src/platform-win32.cc View 1 2 3 3 chunks +8 lines, -9 lines 0 comments Download
M test/cctest/test-sockets.cc View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 3 (0 generated)
Søren Thygesen Gjesse
I got confused by Windows providing shutdown embedded in its closesocket call, which Linux et ...
11 years, 9 months ago (2009-03-19 09:54:14 UTC) #1
Erik Corry
Consider calling shutdown in the destructor. LGTM. 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 ...
11 years, 9 months ago (2009-03-19 11:31:41 UTC) #2
Søren Thygesen Gjesse
11 years, 9 months ago (2009-03-19 11:54:14 UTC) #3
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.

Powered by Google App Engine
This is Rietveld 408576698