<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I have a websocket application that communicates with another server
via a standard socket. What I would like to do is shutdown the
websocket cleanly in the event of the standard socket shutting down.
<br>
At present if I detect the standard socket shutting down I flag the
event and call <tt>libwebsocket_callback_on_writable</tt>. At the
start of the processing of <tt>LWS_CALLBACK_SERVER_WRITEABLE</tt> I
test the flag and return -1 to shutdown the websocket like so:<br>
<tt> case LWS_CALLBACK_SERVER_WRITEABLE:</tt><tt><br>
</tt><tt> {</tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt> if( pss->shutdown ){</tt><tt> // pss is a
pointer to websocket specific user data<br>
</tt><tt> return -1;</tt><tt> // Shutdown
websocket<br>
</tt><tt> }</tt><tt><br>
</tt><tt> ...</tt><br>
However this appears to causes problems in that later I get an
assert in <tt>insert_wsi_socket_into_fds</tt> at <tt>assert(wsi->sock);</tt>
which appears to suggest that the socket has been shutdown but the
websocket object is still being serviced. <br>
Am I shutting down the websocket in the correct manner?<br>
Thanks<br>
Graham<br>
<br>
<div class="moz-signature">-- <br>
<!-- Begin Peavey Digital Research e-mail signature - last modified 04/10/2012 by Stephen Joy -->
<table cellpadding="0" cellspacing="0" width="90%">
<tbody>
<tr>
<td
style="font-size:12.0pt;font-weight:bold;font-family:Arial,sans-serif;color:black">Graham
Newton</td>
</tr>
<tr>
<td
style="font-size:10.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black">Senior
Software Engineer</td>
</tr>
<tr>
<td>
<hr color="#0000A0"></td>
</tr>
<tr>
<td
style="font-size:10.0pt;font-weight:bold;font-family:Arial,sans-serif;color:black">Peavey
Digital Research</td>
</tr>
<tr>
<td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black">A
Division of Peavey Electronics Corporation</td>
</tr>
</tbody>
</table>
<br>
<table cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black"
width="50">Phone</td>
<td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black">+44
1865 734397</td>
</tr>
<tr>
<td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black">Direct</td>
<td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black">+44
1865 734397</td>
</tr>
<tr>
<td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black">Email</td>
<td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black"><a class="moz-txt-link-abbreviated" href="mailto:gnewton@peavey-eu.com">gnewton@peavey-eu.com</a></td>
</tr>
<tr>
<td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black">Web</td>
<td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black"><a
href="http://www.peaveycommercialaudio.com">www.peaveycommercialaudio.com</a>
-
<a href="http://mm.peavey.com">mm.peavey.com</a> -
<a href="http://www.crestaudio.com">www.crestaudio.com</a>
-
<a href="http://aa.peavey.com">aa.peavey.com</a> -
<a href="http://www.peaveyoxford.com">www.peaveyoxford.com</a>
</td>
</tr>
</tbody>
</table>
<br>
<table cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black"><b>PEAVEY
COMMERCIAL AUDIO</b> - Great Folds Road, Corby,
Northamptonshire, NN18 9ET UK</td>
</tr>
<tr>
<td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black"><b>PEAVEY
DIGITAL RESEARCH</b> - 6 Elm Place, Eynsham, Oxfordshire
OX29 4BD UK</td>
</tr>
<tr>
<td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black"><b>PEAVEY
ITALIA</b> - Via P.La Torre 21, Zona Ind.le Cerretano,
60022 Castelfidardo An, Italy</td>
</tr>
<tr>
<td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black"><b>PEAVEY
CHINA</b> - 1F Taiping Yaoye, 3 Gongye Wu Lu, Shekou,
Shenzhen China 518067</td>
</tr>
<tr>
<td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black"><b>PEAVEY
ELECTRONICS CORPORATION</b> - 5022 Hartley Peavey Drive,
Meridian, MS 39305 USA</td>
</tr>
</tbody>
</table>
<br>
<table cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="font-size:7.0pt;font-weight:normal;font-family:Arial,sans-serif;color:#929292">Peavey
Electronics Limited is a registered company in England
& Wales, Company Registration No.: 01249126
<br>
Registered office: GREAT FOLDS ROAD OAKLEY HAY CORBY
NORTHAMPTONSHIRE. NN18 9ET</td>
</tr>
</tbody>
</table>
<!-- End Peavey Digital Research e-mail signature -->
</div>
</body>
</html>