[Libwebsockets] emulated_poll breaks on disabled sockets on Windows XP
"Andy Green (林安廸)"
andy at warmcat.com
Sat Nov 9 01:15:25 CET 2013
On 08/11/13 22:22, the mail apparently from Graham Newton included:
> 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.
Thanks that makes sense it's going to spin if it ever saw a negative fd.
But it seems a bug if something is still in the poll array with a
Anyway it was wrong so pushed here thanks
> Graham Newton
> Senior Software Engineer
> Peavey Digital Research
> A Division of Peavey Electronics Corporation
> Phone +44 1865 734397
> Direct +44 1865 734397
> Email gnewton at peavey-eu.com
> Web www.peaveycommercialaudio.com
> <http://www.peaveycommercialaudio.com> - mm.peavey.com
> <http://mm.peavey.com> - www.crestaudio.com <http://www.crestaudio.com>
> - aa.peavey.com <http://aa.peavey.com> - www.peaveyoxford.com
> *PEAVEY COMMERCIAL AUDIO* - Great Folds Road, Corby, Northamptonshire,
> NN18 9ET UK
> *PEAVEY DIGITAL RESEARCH* - 6 Elm Place, Eynsham, Oxfordshire OX29 4BD UK
> *PEAVEY ITALIA* - Via P.La Torre 21, Zona Ind.le Cerretano, 60022
> Castelfidardo An, Italy
> *PEAVEY CHINA* - 1F Taiping Yaoye, 3 Gongye Wu Lu, Shekou, Shenzhen
> China 518067
> *PEAVEY ELECTRONICS CORPORATION* - 5022 Hartley Peavey Drive, Meridian,
> MS 39305 USA
> Peavey Electronics Limited is a registered company in England & Wales,
> Company Registration No.: 01249126
> Registered office: GREAT FOLDS ROAD OAKLEY HAY CORBY NORTHAMPTONSHIRE.
> NN18 9ET
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
More information about the Libwebsockets