forked from Telodendria/Telodendria
Apply #26
This commit is contained in:
parent
30ae6586b2
commit
538412d1c2
3 changed files with 15 additions and 4 deletions
|
@ -21,6 +21,8 @@
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include <NonPosix.h>
|
||||||
|
|
||||||
#include <HttpServer.h>
|
#include <HttpServer.h>
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
@ -64,7 +66,7 @@ HttpServerCreate(unsigned short port, unsigned int nThreads,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
server->sd = socket(AF_INET, SOCK_STREAM, 0);
|
server->sd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
|
||||||
|
|
||||||
if (server->sd < 0)
|
if (server->sd < 0)
|
||||||
{
|
{
|
||||||
|
@ -129,7 +131,7 @@ HttpServerEventThread(void *args)
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
socklen_t addrLen = sizeof(addr);
|
socklen_t addrLen = sizeof(addr);
|
||||||
int connFd;
|
int connFd;
|
||||||
int pollResult = poll(pollFds, 1, 60 * 1000);
|
int pollResult = poll(pollFds, 1, 500);
|
||||||
|
|
||||||
if (pollResult < 0)
|
if (pollResult < 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include <NonPosix.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -37,8 +39,6 @@
|
||||||
#include <Config.h>
|
#include <Config.h>
|
||||||
#include <HttpServer.h>
|
#include <HttpServer.h>
|
||||||
|
|
||||||
#include <NonPosix.h>
|
|
||||||
|
|
||||||
HttpServer *httpServer = NULL;
|
HttpServer *httpServer = NULL;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -54,6 +54,15 @@ extern int chroot(const char *);
|
||||||
extern int pledge(const char *, const char *);
|
extern int pledge(const char *, const char *);
|
||||||
extern int unveil(const char *, const char *);
|
extern int unveil(const char *, const char *);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* OpenBSD requires that _BSD_SOURCE be set to use SOCK_NONBLOCK for
|
||||||
|
* some reason, even though from everything I can tell, SOCK_NONBLOCK
|
||||||
|
* is POSIX.
|
||||||
|
*/
|
||||||
|
#ifndef _BSD_SOURCE
|
||||||
|
#define _BSD_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue