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

Unified Diff: src/platform-linux.cc

Issue 42387: Change the socket close to shutdown (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/platform-freebsd.cc ('k') | src/platform-macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-linux.cc
===================================================================
--- src/platform-linux.cc (revision 1538)
+++ src/platform-linux.cc (working copy)
@@ -651,9 +651,8 @@
socket_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
}
explicit LinuxSocket(int socket): socket_(socket) { }
+ virtual ~LinuxSocket() { Shutdown(); }
- virtual ~LinuxSocket() { Close(); }
-
// Server initialization.
bool Bind(const int port);
bool Listen(int backlog) const;
@@ -662,8 +661,8 @@
// Client initialization.
bool Connect(const char* host, const char* port);
- // Close.
- bool Close();
+ // Shutdown socket for both read and write.
+ bool Shutdown();
// Data Transimission
int Send(const char* data, int len) const;
@@ -741,10 +740,11 @@
}
-bool LinuxSocket::Close() {
+bool LinuxSocket::Shutdown() {
if (IsValid()) {
- // Close socket.
- int status = close(socket_);
+ // Shutdown socket for both read and write.
+ int status = shutdown(socket_, SHUT_RDWR);
+ close(socket_);
socket_ = -1;
return status == 0;
}
« no previous file with comments | « src/platform-freebsd.cc ('k') | src/platform-macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698