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

Unified Diff: runtime/bin/socket_win.cc

Issue 9381003: Set SO_LINGER on sockets on windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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 | « runtime/bin/eventhandler_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_win.cc
diff --git a/runtime/bin/socket_win.cc b/runtime/bin/socket_win.cc
index f13e0e8efd199183407c03b12e2ef6bd67714c46..dc5dec803671259c58e29ff9fbf1b793918916c1 100644
--- a/runtime/bin/socket_win.cc
+++ b/runtime/bin/socket_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -61,6 +61,18 @@ intptr_t Socket::CreateConnect(const char* host, const intptr_t port) {
return -1;
}
+ linger l;
+ l.l_onoff = 1;
+ l.l_linger = 10;
+ int status = setsockopt(s,
+ SOL_SOCKET,
+ SO_LINGER,
+ reinterpret_cast<char*>(&l),
+ sizeof(l));
+ if (status != NO_ERROR) {
+ FATAL("Failed setting SO_LINGER on socket");
+ }
+
struct hostent* server = gethostbyname(host);
if (server == NULL) {
fprintf(stderr, "Error CreateConnect: %d\n", WSAGetLastError());
@@ -72,7 +84,7 @@ intptr_t Socket::CreateConnect(const char* host, const intptr_t port) {
server_address.sin_family = AF_INET;
server_address.sin_port = htons(port);
server_address.sin_addr.s_addr = inet_addr(host);
- int status = connect(
+ status = connect(
s,
reinterpret_cast<struct sockaddr *>(&server_address),
sizeof(server_address));
« no previous file with comments | « runtime/bin/eventhandler_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698