canonical libwebsockets.org websocket library
Find a file
Graham Newton 7ee4f890a3 windows workaround unsigned fd in emulated poll
A common practise to temporarily disable a socket in a poll call is to negate the socket fd.  poll should then ignore the socket.
emulated_poll does this with the following code:
        if (poll_fd->fd < 0 || !poll_fd->events)
            goto skip1;

However on Windows the fd field in WSAPOLLFD is unsigned int!!!  So the check for a negative fd value always fails.
This results in select returning an error with an error code of 10038 -- Socket operation on nonsocket.
The fix is to type cast fd like so:
        if ((int)poll_fd->fd < 0 || !poll_fd->events)

This may be the cause of some high CPU load reports.  I noticed the load being 50% with my application running on Windows XP.

Signed-off-by: Graham Newton <gnewton@peavey-eu.com>
2013-11-09 08:11:41 +08:00
cmake cmake added RPM generation 2013-04-11 08:38:22 +08:00
lib interface improve visibility fail if not found 2013-11-09 08:07:38 +08:00
scripts add CMake find function for libwebsockets 2013-06-29 10:18:52 +08:00
test-server trac 40 client connection properly nonblocking 2013-09-20 20:26:12 +08:00
win32port windows workaround unsigned fd in emulated poll 2013-11-09 08:11:41 +08:00
.gitignore add static stack analysis 2013-02-10 10:49:15 +08:00
Android.mk android include gregorys example makefile 2013-03-10 07:34:53 +08:00
changelog v1.2.3 changelog update 2013-10-26 20:36:08 +08:00
CMakeLists.txt Windows Fix installing the dll 2013-11-04 10:08:42 +08:00
config.h.cmake Set the _DEBUG macro for CMake also. 2013-02-22 09:28:13 +08:00
cross-arm-linux-gnueabihf.cmake cmake improve cross documentation 2013-03-30 10:30:03 +08:00
libwebsockets-api-doc.html introduce api for unthrottle all connections of protocol 2013-03-16 12:43:22 +08:00
libwebsockets.spec cmake update specfile 2013-03-10 08:12:12 +08:00
LICENSE add static linking exception to LICENSE 2013-02-07 23:44:21 +08:00
README add README 2013-02-06 16:07:27 +09:00
README.build cmake improve cross documentation 2013-03-30 10:30:03 +08:00
README.coding trac 40 client connection properly nonblocking 2013-09-20 20:26:12 +08:00
README.test-apps introduce test echo 2013-01-30 12:28:44 +08:00

This is the libwebsockets C library for lightweight websocket clients and
servers.  For support, visit

 http://libwebsockets.org

and consider joining the project mailing list at

 http://ml.libwebsockets.org/mailman/listinfo/libwebsockets

You can get the latest version of the library from git

http://git.libwebsockets.org
https://github.com/warmcat/libwebsockets

for more information:

README.build      - information on building the library
README.coding     - information for writing code using the library
README.test-apps  - information about the test apps built with the library