mirror of
https://github.com/lxsang/ant-http
synced 2024-12-26 16:58:22 +01:00
fix
This commit is contained in:
parent
4b6de31e66
commit
02d48fb659
BIN
dist/antd-1.0.6b.tar.gz
vendored
BIN
dist/antd-1.0.6b.tar.gz
vendored
Binary file not shown.
@ -673,13 +673,19 @@ int startup(unsigned *port)
|
|||||||
{
|
{
|
||||||
int httpd = 0;
|
int httpd = 0;
|
||||||
struct sockaddr_in name;
|
struct sockaddr_in name;
|
||||||
|
uint8_t on = 1;
|
||||||
httpd = socket(PF_INET, SOCK_STREAM, 0);
|
httpd = socket(PF_INET, SOCK_STREAM, 0);
|
||||||
if (httpd == -1)
|
if (httpd == -1)
|
||||||
{
|
{
|
||||||
ERROR("Port %d - socket: %s", *port, strerror(errno));
|
ERROR("Port %d - socket: %s", *port, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (setsockopt(httpd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) == -1)
|
||||||
|
{
|
||||||
|
ERROR("Unable to set reuse address on port %d - setsockopt: %s", *port, strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
memset(&name, 0, sizeof(name));
|
memset(&name, 0, sizeof(name));
|
||||||
name.sin_family = AF_INET;
|
name.sin_family = AF_INET;
|
||||||
name.sin_port = htons(*port);
|
name.sin_port = htons(*port);
|
||||||
@ -699,6 +705,7 @@ int startup(unsigned *port)
|
|||||||
}
|
}
|
||||||
*port = ntohs(name.sin_port);
|
*port = ntohs(name.sin_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG("back log is %d", server_config.backlog);
|
LOG("back log is %d", server_config.backlog);
|
||||||
if (listen(httpd, server_config.backlog) < 0)
|
if (listen(httpd, server_config.backlog) < 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user