| 235 | } |
| 236 | |
| 237 | void Socket::doShutdown() { |
| 238 | if (m_socketMode <= SocketMode::Shutdown) |
| 239 | return; |
| 240 | |
| 241 | // Set socket mode first so that if this causes an exception the exception |
| 242 | // handlers know the socket is being shut down. |
| 243 | m_socketMode = SocketMode::Shutdown; |
| 244 | |
| 245 | if (m_impl->socketDesc > 0) { |
| 246 | #ifdef STAR_SYSTEM_FAMILY_WINDOWS |
| 247 | ::shutdown(m_impl->socketDesc, SD_BOTH); |
| 248 | #else |
| 249 | ::shutdown(m_impl->socketDesc, SHUT_RDWR); |
| 250 | #endif |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | void Socket::doClose() { |
| 255 | if (m_socketMode == SocketMode::Closed) |