<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 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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-GB" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hello,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">When running the ProxyServer application from the live555 testProgs on windows I have encountered an issue where sockets are not released when a client session is timed out.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Put some logging around the select call in BasicTaskScheduler to output the read, write and except socket counts.<o:p></o:p></p>
<p class="MsoNormal">Run the ProxyServer application as normal and use vlc to view the proxied stream.
<o:p></o:p></p>
<p class="MsoNormal">Then use clumsy to drop all packets between the source and the proxy server.
<o:p></o:p></p>
<p class="MsoNormal">Repeat this test many times, and you’ll eventually hit the FD_SETSIZE limit, so you can no longer open new sockets, you can see this by looking at the output from the logging added to the BasicTaskScheduler.<o:p></o:p></p>
<p class="MsoNormal">The fix appears to be changing the livenessTimeoutTask function to this:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">void</span><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">GenericMediaServer</span><span style="font-size:9.5pt;font-family:Consolas;color:black">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">ClientSession</span><span style="font-size:9.5pt;font-family:Consolas;color:black">::livenessTimeoutTask(</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">ClientSession</span><span style="font-size:9.5pt;font-family:Consolas;color:black">*
</span><span style="font-size:9.5pt;font-family:Consolas;color:gray">clientSession</span><span style="font-size:9.5pt;font-family:Consolas;color:black">) {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:green">// If this gets called, the client session is assumed to have timed out, so delete it:</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:green">//…<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:gray">clientSession</span><span style="font-size:9.5pt;font-family:Consolas;color:black">->fLivenessCheckTask =
</span><span style="font-size:9.5pt;font-family:Consolas;color:#6F008A">NULL</span><span style="font-size:9.5pt;font-family:Consolas;color:black">;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:green">///////// NEW CODE BELOW /////////////<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:green">// Close all client connection objects:</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">GenericMediaServer</span><span style="font-size:9.5pt;font-family:Consolas;color:black">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">ClientConnection</span><span style="font-size:9.5pt;font-family:Consolas;color:black">*
connection;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">while</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> ((connection = (</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">GenericMediaServer</span><span style="font-size:9.5pt;font-family:Consolas;color:black">::</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">ClientConnection</span><span style="font-size:9.5pt;font-family:Consolas;color:black">*)</span><span style="font-size:9.5pt;font-family:Consolas;color:gray">clientSession</span><span style="font-size:9.5pt;font-family:Consolas;color:black">->fOurServer.fClientConnections->getFirst())
!= </span><span style="font-size:9.5pt;font-family:Consolas;color:#6F008A">NULL</span><span style="font-size:9.5pt;font-family:Consolas;color:black">) {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">delete</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> connection;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:green">///////// NEW CODE ABOVE /////////////<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">delete</span><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:gray">clientSession</span><span style="font-size:9.5pt;font-family:Consolas;color:black">;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black">I’m going to subclass the RTSPServer and its dependants so my actual fix won’t be in the live555 codebase, unless you’re willing and able to add the fix in at your end.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black">Thanks.</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="342" style="width:256.5pt;border-collapse:collapse">
<tbody>
<tr style="height:60.7pt">
<td width="150" style="width:112.5pt;border:none;border-right:solid #005D99 1.5pt;padding:0cm 5.4pt 0cm 5.4pt;height:60.7pt">
<p class="MsoNormal" align="center" style="text-align:center"><a href="http://www.scientificgames.com/"><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:windowtext;mso-fareast-language:EN-GB;text-decoration:none"><img border="0" width="130" height="65" style="width:1.3541in;height:.677in" id="Picture_x0020_38" src="cid:image001.png@01D7EC23.8F97F4F0"></span></a><span style="font-size:9.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-GB"><o:p></o:p></span></p>
</td>
<td width="192" valign="top" style="width:144.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:60.7pt">
<p class="MsoNormal" style="margin-bottom:3.0pt"><b><span style="font-family:"Arial",sans-serif;color:#005D99;mso-fareast-language:EN-GB">Mark Hinchcliffe<o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-GB">Solutions Architect<o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-GB">Scientific Games<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#005D99;mso-fareast-language:EN-GB">O:</span></b><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#005D99;mso-fareast-language:EN-GB">
</span><span style="font-size:9.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-GB">N/A
<o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#005D99;mso-fareast-language:EN-GB">M:
</span></b><span style="font-size:9.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-GB">N/A
<o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="color:#005D99;mso-fareast-language:EN-GB"><a href="http://www.sggaming.com/"><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#005D99">Visit SGGaming.com</span></a></span></b><b><u><span style="color:#005D99;mso-fareast-language:EN-GB"><o:p></o:p></span></u></b></p>
<p class="MsoNormal"><a href="https://www.linkedin.com/company/scientific-games/"><b><span style="font-size:8.0pt;font-family:"Arial",sans-serif;color:#C8119F;mso-fareast-language:EN-GB;text-decoration:none"><img border="0" width="29" height="31" style="width:.302in;height:.3229in" id="Picture_x0020_4" src="cid:image002.png@01D7EC23.8F97F4F0" alt="A picture containing drawing, table
Description automatically generated"></span></b></a><span style="font-size:8.0pt;color:#C8119F;mso-fareast-language:EN-GB"><o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>