clientClose_8c-source.html 5.37 KB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>xmlrpc: reader/commonReader/clientClose.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<h1>reader/commonReader/clientClose.c</h1><a href="clientClose_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>     <span class="comment">/* for free() */</span>
<a name="l00002"></a>00002 <span class="preprocessor">#include &lt;unistd.h&gt;</span>     <span class="comment">/* for close() */</span>
<a name="l00003"></a>00003 <span class="preprocessor">#include &lt;sys/socket.h&gt;</span> <span class="comment">/* for shutdown() */</span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &lt;string.h&gt;</span>     <span class="comment">/* for memset and stuff */</span>
<a name="l00005"></a>00005 
<a name="l00006"></a>00006 <span class="preprocessor">#include &lt;expat.h&gt;</span>
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 <span class="preprocessor">#include "../../include/client.h"</span>
<a name="l00009"></a>00009 <span class="preprocessor">#include "../../include/monitor.h"</span>
<a name="l00010"></a>00010 <span class="preprocessor">#include "../../include/httpRequest.h"</span>
<a name="l00011"></a>00011 
<a name="l00012"></a><a class="code" href="clientClose_8c.html#a9dad65338aa78062b23a924ae1d2b59">00012</a> <span class="keywordtype">void</span> <a class="code" href="client_8h.html#a9dad65338aa78062b23a924ae1d2b59">clientClose</a>(<a class="code" href="structtClient.html">tClient</a> * client)
<a name="l00013"></a>00013 {
<a name="l00014"></a>00014     <span class="keywordflow">if</span> (0 != <a class="code" href="client_8h.html#0b2caeb4b6f130be43e5a2f0267dd453">verbose</a>) {
<a name="l00015"></a>00015         syslog(LOG_INFO, <span class="stringliteral">"closing socket for %s"</span>, client-&gt;<a class="code" href="structtClient.html#e23a04145b9c0cc1262721432a43c947">remoteAddr</a>);
<a name="l00016"></a>00016     }
<a name="l00017"></a>00017 
<a name="l00018"></a>00018     <span class="comment">/* close socket an remove from fd_set */</span>
<a name="l00019"></a>00019     shutdown(client-&gt;<a class="code" href="structtClient.html#fdcb6fae6d4162315adc430dc34e3df0">socket</a>, SHUT_RDWR);
<a name="l00020"></a>00020     close(client-&gt;<a class="code" href="structtClient.html#fdcb6fae6d4162315adc430dc34e3df0">socket</a>);
<a name="l00021"></a>00021 
<a name="l00022"></a>00022     <span class="comment">/* free readBuffer */</span>
<a name="l00023"></a>00023     <span class="keywordflow">if</span> (NULL != client-&gt;<a class="code" href="structtClient.html#70a954f8e1e6df925d78b34b9f2f162a">readBuffer</a>) {
<a name="l00024"></a>00024         free(client-&gt;<a class="code" href="structtClient.html#70a954f8e1e6df925d78b34b9f2f162a">readBuffer</a>);
<a name="l00025"></a>00025         client-&gt;<a class="code" href="structtClient.html#70a954f8e1e6df925d78b34b9f2f162a">readBuffer</a>  = NULL;
<a name="l00026"></a>00026     }
<a name="l00027"></a>00027     <span class="keywordflow">if</span> (NULL != client-&gt;<a class="code" href="structtClient.html#99d73b0cba75199cb16952751fdcc52d">writeBuffer</a>) {
<a name="l00028"></a>00028         free(client-&gt;<a class="code" href="structtClient.html#99d73b0cba75199cb16952751fdcc52d">writeBuffer</a>);
<a name="l00029"></a>00029         client-&gt;<a class="code" href="structtClient.html#99d73b0cba75199cb16952751fdcc52d">writeBuffer</a>  = NULL;
<a name="l00030"></a>00030     }
<a name="l00031"></a>00031     client-&gt;<a class="code" href="structtClient.html#0948ef13430298f28cb48199119136c1">readPos</a> = 0;
<a name="l00032"></a>00032     client-&gt;<a class="code" href="structtClient.html#97da33ce83548b5900f11e29d5cec8d1">writePos</a> = 0;
<a name="l00033"></a>00033 
<a name="l00034"></a>00034     <a class="code" href="httpRequest_8h.html#b55d3458cc9e50ef2a22731d910c6385">freeHttpHeader</a>(&amp;(client-&gt;<a class="code" href="structtClient.html#33623f89815acd8a2822a1f04cafe844">httpHeader</a>));
<a name="l00035"></a>00035 
<a name="l00036"></a>00036     XML_ParserFree(client-&gt;<a class="code" href="structtClient.html#b8f8ab3f31d6cf8fd4b3b527ef9c0107">parser</a>);
<a name="l00037"></a>00037 
<a name="l00038"></a>00038     memset(client-&gt;<a class="code" href="structtClient.html#e23a04145b9c0cc1262721432a43c947">remoteAddr</a>, 0, 16);
<a name="l00039"></a>00039 }
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Oct 10 01:24:35 2010 for xmlrpc by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>