forked from Telodendria/Telodendria
Apply #31
This commit is contained in:
parent
fddfbf57ca
commit
5af229a86e
2 changed files with 14 additions and 4 deletions
4
TODO.txt
4
TODO.txt
|
@ -59,8 +59,8 @@ Phase 2: Building a foundation
|
|||
file live there as well.
|
||||
[x] Allow logging to the syslog
|
||||
[x] Fix memory leaks
|
||||
[ ] Fix bug where the socket stays open after quit.
|
||||
[ ] Possibly related to not closing the connections with fclose()?
|
||||
[x] Fix bug where the socket stays open after quit.
|
||||
[x] Possibly related to not closing the connections with fclose()?
|
||||
(see HttpServer.c, grep for fclose)
|
||||
[ ] Figure out how to write unit tests for array/hashmap/etc
|
||||
[ ] Add recipe to td script to upload patches to the Matrix room
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
#include <arpa/inet.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
static const char ENABLE = 1;
|
||||
|
||||
struct HttpServer
|
||||
{
|
||||
int sd;
|
||||
|
@ -357,6 +359,16 @@ HttpServerCreate(unsigned short port, unsigned int nThreads, unsigned int maxCon
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (setsockopt(server->sd, SOL_SOCKET, SO_REUSEADDR, &ENABLE, sizeof(int)) < 0)
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (setsockopt(server->sd, SOL_SOCKET, SO_REUSEPORT, &ENABLE, sizeof(int)) < 0)
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_port = htons(port);
|
||||
sa.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
|
@ -598,9 +610,7 @@ bad_request:
|
|||
|
||||
finish:
|
||||
Free(line);
|
||||
#if 0
|
||||
fclose(fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in a new issue