gdb: reuse socket to avoid long waits between sessions.
This commit is contained in:
parent
4d0a23954f
commit
1fea148de4
5
gdb.c
5
gdb.c
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue