mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00
wince minor adaptations
https://github.com/warmcat/libwebsockets/issues/444
This commit is contained in:
parent
7c8ef84848
commit
3816a05c4f
3 changed files with 28 additions and 1 deletions
|
@ -21,6 +21,10 @@
|
||||||
|
|
||||||
#include "private-libwebsockets.h"
|
#include "private-libwebsockets.h"
|
||||||
|
|
||||||
|
#ifdef LWS_HAVE_SYS_TYPES_H
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int log_level = LLL_ERR | LLL_WARN | LLL_NOTICE;
|
int log_level = LLL_ERR | LLL_WARN | LLL_NOTICE;
|
||||||
static void (*lwsl_emit)(int level, const char *line) = lwsl_emit_stderr;
|
static void (*lwsl_emit)(int level, const char *line) = lwsl_emit_stderr;
|
||||||
|
|
||||||
|
@ -308,6 +312,9 @@ just_kill_connection:
|
||||||
if (n)
|
if (n)
|
||||||
lwsl_debug("closing: shutdown ret %d\n", LWS_ERRNO);
|
lwsl_debug("closing: shutdown ret %d\n", LWS_ERRNO);
|
||||||
|
|
||||||
|
// This causes problems with disconnection when the events are half closing connection
|
||||||
|
// FD_READ | FD_CLOSE (33)
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
/* libuv: no event available to guarantee completion */
|
/* libuv: no event available to guarantee completion */
|
||||||
if (!LWS_LIBUV_ENABLED(context)) {
|
if (!LWS_LIBUV_ENABLED(context)) {
|
||||||
|
|
||||||
|
@ -317,6 +324,7 @@ just_kill_connection:
|
||||||
context->timeout_secs);
|
context->timeout_secs);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -946,11 +954,13 @@ LWS_VISIBLE void lwsl_emit_stderr(int level, const char *line)
|
||||||
#endif
|
#endif
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
ptm = localtime(&o_now);
|
ptm = localtime(&o_now);
|
||||||
#else
|
#else
|
||||||
if (localtime_r(&o_now, &tm))
|
if (localtime_r(&o_now, &tm))
|
||||||
ptm = &tm;
|
ptm = &tm;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
for (n = 0; n < LLL_COUNT; n++) {
|
for (n = 0; n < LLL_COUNT; n++) {
|
||||||
|
|
|
@ -114,9 +114,18 @@ struct sockaddr_in;
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <basetsd.h>
|
#include <basetsd.h>
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#else
|
||||||
|
#define _O_RDONLY 0x0000
|
||||||
|
#define O_RDONLY _O_RDONLY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32_WCE
|
||||||
|
#define strcasecmp _stricmp
|
||||||
|
#else
|
||||||
#define strcasecmp stricmp
|
#define strcasecmp stricmp
|
||||||
|
#endif
|
||||||
#define getdtablesize() 30000
|
#define getdtablesize() 30000
|
||||||
|
|
||||||
#define LWS_INLINE __inline
|
#define LWS_INLINE __inline
|
||||||
|
|
|
@ -271,7 +271,10 @@ lws_plat_set_socket_options(struct lws_context *context, lws_sockfd_type fd)
|
||||||
u_long optl = 1;
|
u_long optl = 1;
|
||||||
DWORD dwBytesRet;
|
DWORD dwBytesRet;
|
||||||
struct tcp_keepalive alive;
|
struct tcp_keepalive alive;
|
||||||
|
int protonbr;
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
struct protoent *tcp_proto;
|
struct protoent *tcp_proto;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (context->ka_time) {
|
if (context->ka_time) {
|
||||||
/* enable keepalive on this socket */
|
/* enable keepalive on this socket */
|
||||||
|
@ -291,13 +294,18 @@ lws_plat_set_socket_options(struct lws_context *context, lws_sockfd_type fd)
|
||||||
|
|
||||||
/* Disable Nagle */
|
/* Disable Nagle */
|
||||||
optval = 1;
|
optval = 1;
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
tcp_proto = getprotobyname("TCP");
|
tcp_proto = getprotobyname("TCP");
|
||||||
if (!tcp_proto) {
|
if (!tcp_proto) {
|
||||||
lwsl_err("getprotobyname() failed with error %d\n", LWS_ERRNO);
|
lwsl_err("getprotobyname() failed with error %d\n", LWS_ERRNO);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
protonbr = tcp_proto->p_proto;
|
||||||
|
#else
|
||||||
|
protonbr = 6;
|
||||||
|
#endif
|
||||||
|
|
||||||
setsockopt(fd, tcp_proto->p_proto, TCP_NODELAY, (const char *)&optval, optlen);
|
setsockopt(fd, protonbr, TCP_NODELAY, (const char *)&optval, optlen);
|
||||||
|
|
||||||
/* We are nonblocking... */
|
/* We are nonblocking... */
|
||||||
ioctlsocket(fd, FIONBIO, &optl);
|
ioctlsocket(fd, FIONBIO, &optl);
|
||||||
|
|
Loading…
Add table
Reference in a new issue