test: add test case for ptr, suppress log.

This commit is contained in:
Nick Peng
2023-04-04 23:58:42 +08:00
parent fbdcb7ba41
commit d4e1da9955
8 changed files with 227 additions and 53 deletions

View File

@@ -243,6 +243,7 @@ bool MockServer::Start(const std::string &url, ServerRequest callback)
int port;
char c_path[256];
int fd;
int yes = 1;
struct sockaddr_storage addr;
socklen_t addrlen;
@@ -271,6 +272,9 @@ bool MockServer::Start(const std::string &url, ServerRequest callback)
return false;
}
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes));
setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof(yes));
if (bind(fd, (struct sockaddr *)&addr, addrlen) != 0) {
close(fd);
return false;