gdb: reuse socket to avoid long waits between sessions.

This commit is contained in:
Daniel Beer 2010-03-23 13:42:44 +13:00
parent 4d0a23954f
commit 1fea148de4
1 changed files with 5 additions and 0 deletions

5
gdb.c
View File

@ -523,6 +523,7 @@ int gdb_server(const struct device *dev, int port)
int client;
struct sockaddr_in addr;
socklen_t len;
int arg;
sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (sock < 0) {
@ -530,6 +531,10 @@ int gdb_server(const struct device *dev, int port)
return -1;
}
arg = 1;
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &arg, sizeof(arg)) < 0)
perror("gdb: warning: can't reuse socket address");
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
addr.sin_addr.s_addr = htonl(INADDR_ANY);