OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 // winsock2.h must be included first in order to ensure it is included before | 8 // winsock2.h must be included first in order to ensure it is included before |
9 // windows.h. | 9 // windows.h. |
10 #include <winsock2.h> | 10 #include <winsock2.h> |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 HANDLE_EINTR(accept(s, reinterpret_cast<sockaddr*>(&from), &from_len)); | 114 HANDLE_EINTR(accept(s, reinterpret_cast<sockaddr*>(&from), &from_len)); |
115 if (conn != kInvalidSocket) { | 115 if (conn != kInvalidSocket) { |
116 net::SetNonBlocking(conn); | 116 net::SetNonBlocking(conn); |
117 } | 117 } |
118 return conn; | 118 return conn; |
119 } | 119 } |
120 | 120 |
121 void ListenSocket::Accept() { | 121 void ListenSocket::Accept() { |
122 SOCKET conn = Accept(socket_); | 122 SOCKET conn = Accept(socket_); |
123 if (conn != kInvalidSocket) { | 123 if (conn != kInvalidSocket) { |
124 scoped_refptr<ListenSocket> sock = | 124 scoped_refptr<ListenSocket> sock( |
125 new ListenSocket(conn, socket_delegate_); | 125 new ListenSocket(conn, socket_delegate_)); |
126 // it's up to the delegate to AddRef if it wants to keep it around | 126 // it's up to the delegate to AddRef if it wants to keep it around |
127 #if defined(OS_POSIX) | 127 #if defined(OS_POSIX) |
128 sock->WatchSocket(WAITING_READ); | 128 sock->WatchSocket(WAITING_READ); |
129 #endif | 129 #endif |
130 socket_delegate_->DidAccept(this, sock); | 130 socket_delegate_->DidAccept(this, sock); |
131 } else { | 131 } else { |
132 // TODO(ibrar): some error handling required here | 132 // TODO(ibrar): some error handling required here |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 } | 310 } |
311 } | 311 } |
312 | 312 |
313 void ListenSocket::OnFileCanWriteWithoutBlocking(int fd) { | 313 void ListenSocket::OnFileCanWriteWithoutBlocking(int fd) { |
314 // MessagePumpLibevent callback, we don't listen for write events | 314 // MessagePumpLibevent callback, we don't listen for write events |
315 // so we shouldn't ever reach here. | 315 // so we shouldn't ever reach here. |
316 NOTREACHED(); | 316 NOTREACHED(); |
317 } | 317 } |
318 | 318 |
319 #endif | 319 #endif |
OLD | NEW |