| Index: src/platform-macos.cc
|
| ===================================================================
|
| --- src/platform-macos.cc (revision 1538)
|
| +++ src/platform-macos.cc (working copy)
|
| @@ -576,9 +576,8 @@
|
| socket_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
| }
|
| explicit MacOSSocket(int socket): socket_(socket) { }
|
| + virtual ~MacOSSocket() { Shutdown(); }
|
|
|
| - virtual ~MacOSSocket() { Close(); }
|
| -
|
| // Server initialization.
|
| bool Bind(const int port);
|
| bool Listen(int backlog) const;
|
| @@ -587,8 +586,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;
|
| @@ -672,10 +671,11 @@
|
| }
|
|
|
|
|
| -bool MacOSSocket::Close() {
|
| +bool MacOSSocket::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;
|
| }
|
|
|