 Chromium Code Reviews
 Chromium Code Reviews Issue 11236025:
  Test that debug stub works with browser.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src/
    
  
    Issue 11236025:
  Test that debug stub works with browser.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src/| Index: net/base/tcp_listen_socket.cc | 
| =================================================================== | 
| --- net/base/tcp_listen_socket.cc (revision 163266) | 
| +++ net/base/tcp_listen_socket.cc (working copy) | 
| @@ -76,6 +76,28 @@ | 
| return s; | 
| } | 
| +SocketDescriptor TCPListenSocket::CreateAndBindAnyPort(const std::string& ip, | 
| + int* port) { | 
| + SocketDescriptor s = CreateAndBind(ip, 0); | 
| 
szym
2012/12/05 18:21:37
You are passing port == 0 to |bind|, which invokes
 
szym
2012/12/05 18:22:31
Sorry, ignore this comment. I forgot to delete it.
 | 
| + sockaddr_in addr; | 
| + socklen_t addr_size = sizeof(addr); | 
| + bool failed = getsockname(s, (struct sockaddr *) &addr, &addr_size) != 0; | 
| + if (addr_size != sizeof(addr)) { | 
| + failed = true; | 
| + } | 
| + if (failed) { | 
| + LOG(ERROR) << "Could not determine binded port, getsockname() failed"; | 
| +#if defined(OS_WIN) | 
| + closesocket(s); | 
| +#elif defined(OS_POSIX) | 
| + close(s); | 
| +#endif | 
| + return kInvalidSocket; | 
| + } | 
| + *port = base::NetToHost16(addr.sin_port); | 
| + return s; | 
| +} | 
| + | 
| void TCPListenSocket::Accept() { | 
| SocketDescriptor conn = AcceptSocket(); | 
| if (conn == kInvalidSocket) |