diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/a02770.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to 'docs/doxygen/nel/a02770.html')
-rw-r--r-- | docs/doxygen/nel/a02770.html | 575 |
1 files changed, 575 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a02770.html b/docs/doxygen/nel/a02770.html new file mode 100644 index 00000000..3184ff11 --- /dev/null +++ b/docs/doxygen/nel/a02770.html @@ -0,0 +1,575 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NLNET::CListenTask class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NLNET::CListenTask Class Reference</h1><code>#include <<a class="el" href="a05513.html">buf_server.h</a>></code> +<p> +<p>Inheritance diagram for NLNET::CListenTask: +<p><center><img src="a02770.png" usemap="#NLNET::CListenTask_map" border="0" alt=""></center> +<map name="NLNET::CListenTask_map"> +<area href="a02187.html" alt="NLMISC::IRunnable" shape="rect" coords="0,0,132,24"> +<area href="a02771.html" alt="NLNET::CServerTask" shape="rect" coords="142,0,274,24"> +</map> +<hr><a name="_details"></a><h2>Detailed Description</h2> +Code of listening thread +<p> + +<p> +Definition at line <a class="el" href="a05513.html#l00087">87</a> of file <a class="el" href="a05513.html">buf_server.h</a>.<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02770.html#NLNET_1_1CListenTaska0">CListenTask</a> (<a class="el" href="a02302.html">CBufServer</a> *server)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <a href="#NLNET_1_1CListenTaska0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02770.html#NLNET_1_1CListenTaska1">close</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Close listening socket. <a href="#NLNET_1_1CListenTaska1"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="a02187.html#NLMISC_1_1IRunnablePosa0">getName</a> (std::string &result) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02770.html#NLNET_1_1CListenTaska3">init</a> (<a class="el" href="a04558.html#a9">uint16</a> port, <a class="el" href="a04558.html#a10">sint32</a> maxExpectedBlockSize)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Begins to listen on the specified port (call before running thread). <a href="#NLNET_1_1CListenTaska3"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a02665.html">CInetAddress</a> & </td><td class="memItemRight" valign=bottom><a class="el" href="a02770.html#NLNET_1_1CListenTaska4">localAddr</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the listening address. <a href="#NLNET_1_1CListenTaska4"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02771.html#NLNET_1_1CServerTaska0">requireExit</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Tells the task to exit. <a href="#NLNET_1_1CServerTaska0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="a02770.html#NLNET_1_1CListenTaska6">run</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Run (exits when the listening socket disconnects). <a href="#NLNET_1_1CListenTaska6"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Data Fields</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02771.html#NLNET_1_1CServerTasko0">NbLoop</a></td></tr> + +<tr><td colspan=2><br><h2>Protected Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02771.html#NLNET_1_1CServerTaskb1">exitRequired</a> () const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns true if the <a class="el" href="a02771.html#NLNET_1_1CServerTaska0">requireExit()</a> has been called. <a href="#NLNET_1_1CServerTaskb1"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02769.html">CListenSock</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02770.html#NLNET_1_1CListenTaskr0">_ListenSock</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02770.html#NLNET_1_1CListenTaskr1">_MaxExpectedBlockSize</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02302.html">CBufServer</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02770.html#NLNET_1_1CListenTaskr2">_Server</a></td></tr> + +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NLNET_1_1CListenTaska0" doxytag="NLNET::CListenTask::CListenTask" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLNET::CListenTask::CListenTask </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02302.html">CBufServer</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>server</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Constructor. +<p> + +<p> +Definition at line <a class="el" href="a05513.html#l00092">92</a> of file <a class="el" href="a05513.html">buf_server.h</a>. +<p> +References <a class="el" href="a05513.html#l00108">_Server</a>. +<p> +<div class="fragment"><pre>00092 : <a class="code" href="a02771.html#NLNET_1_1CServerTaskb0">CServerTask</a>(), <a class="code" href="a02770.html#NLNET_1_1CListenTaskr2">_Server</a>(server) {} +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NLNET_1_1CListenTaska1" doxytag="NLNET::CListenTask::close" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CListenTask::close </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Close listening socket. +<p> + +<p> +Definition at line <a class="el" href="a05513.html#l00101">101</a> of file <a class="el" href="a05513.html">buf_server.h</a>. +<p> +References <a class="el" href="a05513.html#l00109">_ListenSock</a>, and <a class="el" href="a02444.html#NLNET_1_1CUdpSockz2103_0">NLNET::CSock::close()</a>. +<p> +<div class="fragment"><pre>00101 { <a class="code" href="a02770.html#NLNET_1_1CListenTaskr0">_ListenSock</a>.close(); } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CServerTaskb1" doxytag="NLNET::CListenTask::exitRequired" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLNET::CServerTask::exitRequired </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [inline, protected, inherited]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns true if the <a class="el" href="a02771.html#NLNET_1_1CServerTaska0">requireExit()</a> has been called. +<p> + +<p> +Definition at line <a class="el" href="a05513.html#l00071">71</a> of file <a class="el" href="a05513.html">buf_server.h</a>. +<p> +References <a class="el" href="a05513.html#l00080">NLNET::CServerTask::_ExitRequired</a>. +<p> +Referenced by <a class="el" href="a05512.html#l00987">NLNET::CServerReceiveTask::run()</a>, and <a class="el" href="a05512.html#l00779">run()</a>. +<p> +<div class="fragment"><pre>00071 { <span class="keywordflow">return</span> _ExitRequired; } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1IRunnablePosa0" doxytag="NLNET::CListenTask::getName" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> virtual void NLMISC::IRunnable::getName </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">std::string & </td> + <td class="mdname1" valign="top" nowrap> <em>result</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [inline, virtual, inherited]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Reimplemented in <a class="el" href="a02220.html#NL3D_1_1CAsyncFileManager3D_1_1CMeshLoada1">NL3D::CAsyncFileManager3D::CMeshLoad</a>, <a class="el" href="a02218.html#NL3D_1_1CAsyncFileManager3D_1_1CIGLoada1">NL3D::CAsyncFileManager3D::CIGLoad</a>, <a class="el" href="a02219.html#NL3D_1_1CAsyncFileManager3D_1_1CIGLoadUsera1">NL3D::CAsyncFileManager3D::CIGLoadUser</a>, <a class="el" href="a02222.html#NL3D_1_1CAsyncFileManager3D_1_1CTextureLoada1">NL3D::CAsyncFileManager3D::CTextureLoad</a>, <a class="el" href="a03752.html#NL3D_1_1CZoneLoadingTaska1">NL3D::CZoneLoadingTask</a>, <a class="el" href="a02593.html#NLPACS_1_1CGlobalRetriever_1_1CLrLoadera1">NLPACS::CGlobalRetriever::CLrLoader</a>, <a class="el" href="a02223.html#NLMISC_1_1CAsyncFileManager_1_1CFileLoada1">NLMISC::CAsyncFileManager::CFileLoad</a>, <a class="el" href="a02224.html#NLMISC_1_1CAsyncFileManager_1_1CMultipleFileLoada1">NLMISC::CAsyncFileManager::CMultipleFileLoad</a>, and <a class="el" href="a02225.html#NLMISC_1_1CAsyncFileManager_1_1CSignala1">NLMISC::CAsyncFileManager::CSignal</a>. +<p> +Definition at line <a class="el" href="a06535.html#l00074">74</a> of file <a class="el" href="a06535.html">thread.h</a>. +<p> +Referenced by <a class="el" href="a06485.html#l00061">NLMISC::CTaskManager::run()</a>. +<p> +<div class="fragment"><pre>00075 { +00076 result = <span class="stringliteral">"NoName"</span>; +00077 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CListenTaska3" doxytag="NLNET::CListenTask::init" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CListenTask::init </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>port</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a10">sint32</a> </td> + <td class="mdname" nowrap> <em>maxExpectedBlockSize</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Begins to listen on the specified port (call before running thread). +<p> + +<p> +Definition at line <a class="el" href="a05512.html#l00111">111</a> of file <a class="el" href="a05512.html">buf_server.cpp</a>. +<p> +References <a class="el" href="a05513.html#l00109">_ListenSock</a>, <a class="el" href="a05913.html#l00076">NLNET::CListenSock::init()</a>, <a class="el" href="a05515.html#l00040">nlnettrace</a>, <a class="el" href="a05981.html#l00099">sint32</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +Referenced by <a class="el" href="a05512.html#l00093">NLNET::CBufServer::init()</a>. +<p> +<div class="fragment"><pre>00112 { +00113 <a class="code" href="a04092.html#a0">nlnettrace</a>( <span class="stringliteral">"CListenTask::init"</span> ); +00114 <a class="code" href="a02770.html#NLNET_1_1CListenTaskr0">_ListenSock</a>.init( port ); +00115 <a class="code" href="a02770.html#NLNET_1_1CListenTaskr1">_MaxExpectedBlockSize</a> = maxExpectedBlockSize; +00116 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CListenTaska4" doxytag="NLNET::CListenTask::localAddr" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const <a class="el" href="a02665.html">CInetAddress</a>& NLNET::CListenTask::localAddr </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns the listening address. +<p> + +<p> +Definition at line <a class="el" href="a05513.html#l00104">104</a> of file <a class="el" href="a05513.html">buf_server.h</a>. +<p> +References <a class="el" href="a05513.html#l00109">_ListenSock</a>, and <a class="el" href="a06405.html#l00235">NLNET::CSock::localAddr()</a>. +<p> +Referenced by <a class="el" href="a05513.html#l00238">NLNET::CBufServer::listenAddress()</a>. +<p> +<div class="fragment"><pre>00104 { <span class="keywordflow">return</span> <a class="code" href="a02770.html#NLNET_1_1CListenTaskr0">_ListenSock</a>.localAddr(); } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CServerTaska0" doxytag="NLNET::CListenTask::requireExit" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CServerTask::requireExit </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, inherited]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Tells the task to exit. +<p> + +<p> +Definition at line <a class="el" href="a05513.html#l00056">56</a> of file <a class="el" href="a05513.html">buf_server.h</a>. +<p> +References <a class="el" href="a05513.html#l00080">NLNET::CServerTask::_ExitRequired</a>. +<p> +Referenced by <a class="el" href="a05512.html#l00166">NLNET::CBufServer::~CBufServer()</a>. +<p> +<div class="fragment"><pre>00056 { _ExitRequired = <span class="keyword">true</span>; } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CListenTaska6" doxytag="NLNET::CListenTask::run" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CListenTask::run </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [virtual]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Run (exits when the listening socket disconnects). +<p> + +<p> +Implements <a class="el" href="a02187.html#NLMISC_1_1IRunnablePosa1">NLMISC::IRunnable</a>. +<p> +Definition at line <a class="el" href="a05512.html#l00779">779</a> of file <a class="el" href="a05512.html">buf_server.cpp</a>. +<p> +References <a class="el" href="a05513.html#l00109">_ListenSock</a>, <a class="el" href="a05513.html#l00108">_Server</a>, <a class="el" href="a05913.html#l00129">NLNET::CListenSock::accept()</a>, <a class="el" href="a05515.html#l00359">NLNET::CServerBufSock::advertiseConnection()</a>, <a class="el" href="a05514.html#l00329">NLNET::CBufSock::asString()</a>, <a class="el" href="a06405.html#l00241">NLNET::CSock::descriptor()</a>, <a class="el" href="a05512.html#l00866">NLNET::CBufServer::dispatchNewSocket()</a>, <a class="el" href="a05513.html#l00071">NLNET::CServerTask::exitRequired()</a>, <a class="el" href="a05510.html#l00036">NLNET::NbNetworkTask</a>, <a class="el" href="a05512.html#l00048">NLNET::NbServerListenTask</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05622.html#l00154">nlerror</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, <a class="el" href="a05515.html#l00040">nlnettrace</a>, <a class="el" href="a05513.html#l00276">NLNET::CBufServer::noDelay()</a>, <a class="el" href="a05646.html#l01119">res</a>, <a class="el" href="a05515.html#l00289">NLNET::CNonBlockingBufSock::setMaxExpectedBlockSize()</a>, <a class="el" href="a06487.html#l00146">NLNET::CTcpSock::setNoDelay()</a>, <a class="el" href="a05515.html#l00286">NLNET::CNonBlockingBufSock::setNonBlocking()</a>, <a class="el" href="a05515.html#l00243">NLNET::CBufSock::Sock</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>00780 { +00781 <a class="code" href="a05379.html#a8">NbNetworkTask</a>++; +00782 <a class="code" href="a05379.html#a9">NbServerListenTask</a>++; +00783 +00784 <a class="code" href="a04092.html#a0">nlnettrace</a>( <span class="stringliteral">"CListenTask::run"</span> ); +00785 +00786 <span class="preprocessor">#ifdef NL_OS_UNIX</span> +00787 <span class="preprocessor"></span> SOCKET descmax; +00788 fd_set readers; +00789 timeval tv; +00790 descmax = <a class="code" href="a02770.html#NLNET_1_1CListenTaskr0">_ListenSock</a>.descriptor()>_WakeUpPipeHandle[PipeRead]?<a class="code" href="a02770.html#NLNET_1_1CListenTaskr0">_ListenSock</a>.descriptor():_WakeUpPipeHandle[PipeRead]; +00791 <span class="preprocessor">#endif</span> +00792 <span class="preprocessor"></span> +00793 <span class="comment">// Accept connections</span> +00794 <span class="keywordflow">while</span> ( ! <a class="code" href="a02771.html#NLNET_1_1CServerTaskb1">exitRequired</a>() ) +00795 { +00796 <span class="keywordflow">try</span> +00797 { +00798 <span class="comment">// Get and setup the new socket</span> +00799 <span class="preprocessor">#ifdef NL_OS_UNIX</span> +00800 <span class="preprocessor"></span> FD_ZERO( &readers ); +00801 FD_SET( <a class="code" href="a02770.html#NLNET_1_1CListenTaskr0">_ListenSock</a>.descriptor(), &readers ); +00802 FD_SET( _WakeUpPipeHandle[PipeRead], &readers ); +00803 tv.tv_sec = 60; +00804 tv.tv_usec = 0; +00805 <span class="keywordtype">int</span> <a class="code" href="a04223.html#a643">res</a> = ::select( descmax+1, &readers, NULL, NULL, &tv ); +00806 +00807 <span class="keywordflow">switch</span> ( <a class="code" href="a04223.html#a643">res</a> ) +00808 { +00809 <span class="keywordflow">case</span> 0 : <span class="keywordflow">continue</span>; <span class="comment">// time-out expired, no results</span> +00810 <span class="keywordflow">case</span> -1 : +00811 <span class="comment">// we'll ignore message (Interrupted system call) caused by a CTRL-C</span> +00812 <span class="keywordflow">if</span> (CSock::getLastError() == 4) +00813 { +00814 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"LNETL1: Select failed (in listen thread): %s (code %u) but IGNORED"</span>, CSock::errorString( CSock::getLastError() ).c_str(), CSock::getLastError()); +00815 <span class="keywordflow">continue</span>; +00816 } +00817 <a class="code" href="a04199.html#a3">nlerror</a>( <span class="stringliteral">"LNETL1: Select failed (in listen thread): %s (code %u)"</span>, CSock::errorString( CSock::getLastError() ).c_str(), CSock::getLastError() ); +00818 } +00819 +00820 <span class="keywordflow">if</span> ( FD_ISSET( _WakeUpPipeHandle[PipeRead], &readers ) ) +00821 { +00822 <a class="code" href="a04558.html#a7">uint8</a> b; +00823 <span class="keywordflow">if</span> ( read( _WakeUpPipeHandle[PipeRead], &b, 1 ) == -1 ) <span class="comment">// we were woken-up by the wake-up pipe</span> +00824 { +00825 <a class="code" href="a04199.html#a0">nldebug</a>( <span class="stringliteral">"LNETL1: In CListenTask::run(): read() failed"</span> ); +00826 } +00827 <a class="code" href="a04199.html#a0">nldebug</a>( <span class="stringliteral">"LNETL1: listen thread select woken-up"</span> ); +00828 <span class="keywordflow">continue</span>; +00829 } +00830 <span class="preprocessor">#endif</span> +00831 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>( <span class="stringliteral">"LNETL1: Waiting incoming connection..."</span> ); +00832 CServerBufSock *bufsock = <span class="keyword">new</span> CServerBufSock( <a class="code" href="a02770.html#NLNET_1_1CListenTaskr0">_ListenSock</a>.accept() ); +00833 <a class="code" href="a04199.html#a0">nldebug</a>( <span class="stringliteral">"LNETL1: New connection : %s"</span>, bufsock->asString().c_str() ); +00834 bufsock->setNonBlocking(); +00835 bufsock->setMaxExpectedBlockSize( _MaxExpectedBlockSize ); +00836 <span class="keywordflow">if</span> ( <a class="code" href="a02770.html#NLNET_1_1CListenTaskr2">_Server</a>->noDelay() ) +00837 { +00838 bufsock->Sock->setNoDelay( <span class="keyword">true</span> ); +00839 } +00840 +00841 <span class="comment">// Notify the new connection</span> +00842 bufsock->advertiseConnection( _Server ); +00843 +00844 <span class="comment">// Dispatch the socket into the thread pool</span> +00845 <a class="code" href="a02770.html#NLNET_1_1CListenTaskr2">_Server</a>->dispatchNewSocket( bufsock ); +00846 +00847 <a class="code" href="a02771.html#NLNET_1_1CServerTasko0">NbLoop</a>++; +00848 } +00849 <span class="keywordflow">catch</span> ( ESocket& e ) +00850 { +00851 <a class="code" href="a04199.html#a1">nlinfo</a>( <span class="stringliteral">"LNETL1: Exception in listen thread: %s"</span>, e.what() ); <span class="comment">// It can occur in normal behavior (e.g. when exiting)</span> +00852 <span class="comment">// It can also occur when too many sockets are open (e.g. 885 connections)</span> +00853 } +00854 } +00855 +00856 <a class="code" href="a04092.html#a0">nlnettrace</a>( <span class="stringliteral">"Exiting CListenTask::run"</span> ); +00857 <a class="code" href="a05379.html#a9">NbServerListenTask</a>--; +00858 <a class="code" href="a05379.html#a8">NbNetworkTask</a>--; +00859 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NLNET_1_1CListenTaskr0" doxytag="NLNET::CListenTask::_ListenSock" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02769.html">CListenSock</a> <a class="el" href="a02770.html#NLNET_1_1CListenTaskr0">NLNET::CListenTask::_ListenSock</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05513.html#l00109">109</a> of file <a class="el" href="a05513.html">buf_server.h</a>. +<p> +Referenced by <a class="el" href="a05513.html#l00101">close()</a>, <a class="el" href="a05512.html#l00111">init()</a>, <a class="el" href="a05513.html#l00104">localAddr()</a>, and <a class="el" href="a05512.html#l00779">run()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CListenTaskr1" doxytag="NLNET::CListenTask::_MaxExpectedBlockSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02770.html#NLNET_1_1CListenTaskr1">NLNET::CListenTask::_MaxExpectedBlockSize</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05513.html#l00110">110</a> of file <a class="el" href="a05513.html">buf_server.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CListenTaskr2" doxytag="NLNET::CListenTask::_Server" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02302.html">CBufServer</a>* <a class="el" href="a02770.html#NLNET_1_1CListenTaskr2">NLNET::CListenTask::_Server</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05513.html#l00108">108</a> of file <a class="el" href="a05513.html">buf_server.h</a>. +<p> +Referenced by <a class="el" href="a05513.html#l00092">CListenTask()</a>, and <a class="el" href="a05512.html#l00779">run()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CServerTasko0" doxytag="NLNET::CListenTask::NbLoop" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02771.html#NLNET_1_1CServerTasko0">NLNET::CServerTask::NbLoop</a><code> [inherited]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05513.html#l00063">63</a> of file <a class="el" href="a05513.html">buf_server.h</a>. +<p> +Referenced by <a class="el" href="a05512.html#l00695">NLNET::CBufServer::displayThreadStat()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a05513.html">buf_server.h</a><li><a class="el" href="a05512.html">buf_server.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 13:58:21 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |