<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I’ll give that a try if I manage to reproduce it in the staging environment.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> enet-discuss-bounces@cubik.org [mailto:enet-discuss-bounces@cubik.org] <b>On Behalf Of </b>Ruud van Gaal<br><b>Sent:</b> Tuesday, June 19, 2012 4:41 PM<br><b>To:</b> Discussion of the ENet library<br><b>Subject:</b> Re: [ENet-discuss] enet is dropping packets<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>What happens if you do pass 0 to the timeout, and let it just spin (as a test)?<o:p></o:p></p><div><p class=MsoNormal>Does it still drop huge amounts of packets and expose the same kinds of problems?<o:p></o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'>Ruud<o:p></o:p></p><div><p class=MsoNormal>On Tue, Jun 19, 2012 at 11:13 PM, Soren Dreijer <<a href="mailto:dreijer@echobit.net" target="_blank">dreijer@echobit.net</a>> wrote:<o:p></o:p></p><p class=MsoNormal>Well, so regardless of whether the timer enet uses is inaccurate, it's<br>guaranteed that enet_host_service() returns as soon as new packets have been<br>received (courtesy of select()). That means that my process should be<br>spinning at 100% CPU if it's struggling to keep up with all the incoming<br>packets, but it isn't.<br><br>That's what puzzles me. You're correct in that I could just do my own sleep<br>to optimize the loop so I can send packets as fast as possible, but that<br>doesn't solve the issue at hand, unfortunately.<br><br>I'm trying to repro this in a staging environment since I can't just restart<br>the server in production as it'll impact a good bunch of users.<o:p></o:p></p><div><div><p class=MsoNormal><br>> -----Original Message-----<br>> From: <a href="mailto:enet-discuss-bounces@cubik.org">enet-discuss-bounces@cubik.org</a> [mailto:<a href="mailto:enet-discuss-">enet-discuss-</a><br>> <a href="mailto:bounces@cubik.org">bounces@cubik.org</a>] On Behalf Of James B<br>> Sent: Tuesday, June 19, 2012 3:54 PM<br>> To: <a href="mailto:enet-discuss@cubik.org">enet-discuss@cubik.org</a><br>> Subject: Re: [ENet-discuss] enet is dropping packets<br>><br>><br>> why not just call enet_host_service with a timeout of 0, then if you<br>haven't<br>> received any packets in X seconds do your own sleep(1) so you don't eat<br>all<br>> the cpu.  also i don't know what platform you are on, but making enet<br>sleep<br>> is not a wise choice IMO, for example on windows it uses timeGetTime which<br>> can be 5ms or more inaccurate, meaning you could only be processing the<br>> event loop 200 times per second rather than 1000 as you think.  what's<br>worse<br>> in my testing is Sleep() and timegettime can be more inaccurate than that,<br>> sometimes sleep will sleep 5ms or 30ms, no matter the argument passed,<br>> which is why its much better to use an adaptive technique where you only<br>> sleep during times of low load, and where you control the sleep.  a good<br>> implementation might be to examine your current packets processed per<br>> second, and if this is under some value then sleep(1), if not then<br>sleep(0)<br>><br>> ----------------------------------------<br>> > From: <a href="mailto:dreijer@echobit.net">dreijer@echobit.net</a><br>> > To: <a href="mailto:enet-discuss@cubik.org">enet-discuss@cubik.org</a><br>> > Date: Tue, 19 Jun 2012 15:30:14 -0500<br>> > Subject: Re: [ENet-discuss] enet is dropping packets<br>> ><br>> > > Eh, it is an upper bound on the wait time if nothing is received!<br>> ><br>> > Are you absolutely sure about this? I seem to recall back when I started<br>> > with enet that calling enet_host_service() with a high timeout would<br>cause<br>> > huge delays in receiving packets because enet_host_service() wouldn't<br>> return<br>> > until the timeout has expired. I'll verify that again, but I thought<br>that<br>> > was how it worked at least.<br>> ><br>> > I find it hard to believe that my dedicated thread cannot service<br>packets<br>> > for 124 users (who aren't really sending THAT much data) if the thread<br>is<br>> > running as fast as it can.<br>><br>><br>> _______________________________________________<br>> ENet-discuss mailing list<br>> <a href="mailto:ENet-discuss@cubik.org">ENet-discuss@cubik.org</a><br>> <a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br><br>_______________________________________________<br>ENet-discuss mailing list<br><a href="mailto:ENet-discuss@cubik.org">ENet-discuss@cubik.org</a><br><a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><o:p></o:p></p></div></div></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></div></body></html>