Commit 32de098e authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

Allow the debugger agent to reuse ports stuck in TIME_WAIT for listening.

When the debugger agent terminates the used port can be stuck in TIME_WAIT for some time depending on the OS and the state of the socket. With this change will allow the debug agent to start listening on a port still in TIME_WAIT. During development of both V8 and embedding applications this makes it much easier to restart an application using the debugger agent.

This also makes it possible to run the tests involving the debugger agent multiple times without failure.
Review URL: http://codereview.chromium.org/50050

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1558 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 83111deb
......@@ -44,6 +44,9 @@ void DebuggerAgentMessageHandler(const uint16_t* message, int length,
void DebuggerAgent::Run() {
const int kOneSecondInMicros = 1000000;
// Allow this socket to reuse port even if still in TIME_WAIT.
server_->SetReuseAddress(true);
// First bind the socket to the requested port.
bool bound = false;
while (!bound && !terminate_) {
......
......@@ -3824,8 +3824,6 @@ TEST(DebuggerHostDispatch) {
}
// This test fails on some Linux versions - disabled for now.
#if 0
TEST(DebuggerAgent) {
// Make sure this port is not used by other tests to allow tests to run in
// parallel.
......@@ -3865,4 +3863,3 @@ TEST(DebuggerAgent) {
delete server;
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment