1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Passenger: Passenger::Process Class Reference</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 Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespacePassenger.html">Passenger</a>::<a class="el" href="classPassenger_1_1Process.html">Process</a>
</div>
</div>
<div class="contents">
<h1>Passenger::Process Class Reference<br>
<small>
[<a class="el" href="group__Support.html">Apache-independent support classes and function</a>]</small>
</h1><!-- doxytag: class="Passenger::Process" -->Represents a single application process, as spawned by <a class="el" href="classPassenger_1_1SpawnManager.html" title="An AbstractSpawnManager implementation.">SpawnManager</a> or by ApplicationPool::Interface::get().
<a href="#_details">More...</a>
<p>
<code>#include <<a class="el" href="Process_8h-source.html">Process.h</a>></code>
<p>
<p>
<a href="classPassenger_1_1Process-members.html">List of all members.</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="classPassenger_1_1Process.html#cbc73466ae557c68cf040fcce925096c">Process</a> (const string &appRoot, pid_t pid, int ownerPipe, const SocketInfoMap &serverSockets, const string &detachKey, const string &connectPassword, const function< void()> &destructionCallback=function< void()>())</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Construct a new <a class="el" href="classPassenger_1_1Process.html" title="Represents a single application process, as spawned by SpawnManager or by ApplicationPool::Interface...">Process</a> object. <a href="#cbc73466ae557c68cf040fcce925096c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1Process.html#ce9e949fa460ce09228cc08d76fc38e7">getAppRoot</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the application root for this application process. <a href="#ce9e949fa460ce09228cc08d76fc38e7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="fc1b82c05e963fee7e58445b152ca784"></a><!-- doxytag: member="Passenger::Process::getPid" ref="fc1b82c05e963fee7e58445b152ca784" args="() const " -->
pid_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1Process.html#fc1b82c05e963fee7e58445b152ca784">getPid</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the process ID of this application process. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="308fa4c3bf80e4d3d48a3c833b9e3205"></a><!-- doxytag: member="Passenger::Process::getDetachKey" ref="308fa4c3bf80e4d3d48a3c833b9e3205" args="() const " -->
string </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1Process.html#308fa4c3bf80e4d3d48a3c833b9e3205">getDetachKey</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns this process's detach key. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1Process.html#002791d7909d4d7a6566eb26ec491552">getConnectPassword</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns this process's connect password. <a href="#002791d7909d4d7a6566eb26ec491552"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="fe06f5be540203452a5e787da15ee5e4"></a><!-- doxytag: member="Passenger::Process::getServerSockets" ref="fe06f5be540203452a5e787da15ee5e4" args="() const " -->
const SocketInfoMap * </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1Process.html#fe06f5be540203452a5e787da15ee5e4">getServerSockets</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns a map containing all server sockets that this process listens on. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">SessionPtr </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1Process.html#a5bd9ad8220bf64e5edf3d025004547a">newSession</a> (const function< void()> &closeCallback=function< void()>(), bool initiateNow=true)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Request a new session from this application process by connecting to its main server socket. <a href="#a5bd9ad8220bf64e5edf3d025004547a"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Represents a single application process, as spawned by <a class="el" href="classPassenger_1_1SpawnManager.html" title="An AbstractSpawnManager implementation.">SpawnManager</a> or by ApplicationPool::Interface::get(). <hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="cbc73466ae557c68cf040fcce925096c"></a><!-- doxytag: member="Passenger::Process::Process" ref="cbc73466ae557c68cf040fcce925096c" args="(const string &appRoot, pid_t pid, int ownerPipe, const SocketInfoMap &serverSockets, const string &detachKey, const string &connectPassword, const function< void()> &destructionCallback=function< void()>())" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Passenger::Process::Process </td>
<td>(</td>
<td class="paramtype">const string & </td>
<td class="paramname"> <em>appRoot</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">pid_t </td>
<td class="paramname"> <em>pid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"> <em>ownerPipe</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const SocketInfoMap & </td>
<td class="paramname"> <em>serverSockets</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const string & </td>
<td class="paramname"> <em>detachKey</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const string & </td>
<td class="paramname"> <em>connectPassword</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const function< void()> & </td>
<td class="paramname"> <em>destructionCallback</em> = <code>function<void ()>()</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Construct a new <a class="el" href="classPassenger_1_1Process.html" title="Represents a single application process, as spawned by SpawnManager or by ApplicationPool::Interface...">Process</a> object.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>appRoot</em> </td><td>The application root of an application. This must be a valid directory, but the path does not have to be absolute. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>pid</em> </td><td>The process ID of this application process. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ownerPipe</em> </td><td>The owner pipe of this application process. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>serverSockets</em> </td><td>All the server sockets that this process listens on. There must a server socket with the name 'main'. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>detachKey</em> </td><td>A detach key. Used by the ApplicationPool algorithm. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>connectPassword</em> </td><td>The password to use when connecting to this process. Must be valid ASCII. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>destructionCallback</em> </td><td>A callback to be called when this <a class="el" href="classPassenger_1_1Process.html" title="Represents a single application process, as spawned by SpawnManager or by ApplicationPool::Interface...">Process</a> is destroyed. </td></tr>
</table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1ArgumentException.html" title="Indicates that a specified argument is incorrect or violates a requirement.">ArgumentException</a></em> </td><td>If serverSockets has no socket named 'main'. </td></tr>
</table>
</dl>
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="ce9e949fa460ce09228cc08d76fc38e7"></a><!-- doxytag: member="Passenger::Process::getAppRoot" ref="ce9e949fa460ce09228cc08d76fc38e7" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">string Passenger::Process::getAppRoot </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the application root for this application process.
<p>
See the constructor for information about the application root.
</div>
</div><p>
<a class="anchor" name="002791d7909d4d7a6566eb26ec491552"></a><!-- doxytag: member="Passenger::Process::getConnectPassword" ref="002791d7909d4d7a6566eb26ec491552" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">string Passenger::Process::getConnectPassword </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns this process's connect password.
<p>
This password is guaranteed to be valid ASCII.
</div>
</div><p>
<a class="anchor" name="a5bd9ad8220bf64e5edf3d025004547a"></a><!-- doxytag: member="Passenger::Process::newSession" ref="a5bd9ad8220bf64e5edf3d025004547a" args="(const function< void()> &closeCallback=function< void()>(), bool initiateNow=true)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">SessionPtr Passenger::Process::newSession </td>
<td>(</td>
<td class="paramtype">const function< void()> & </td>
<td class="paramname"> <em>closeCallback</em> = <code>function<void()>()</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>initiateNow</em> = <code>true</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Request a new session from this application process by connecting to its main server socket.
<p>
This session represents the life time of a single request/response pair, and can be used to send the request data to the application process, as well as receiving the response data.<p>
The use of connect() is demonstrated in the following example. <div class="fragment"><pre class="fragment"> <span class="comment">// Request a new session from the process.</span>
SessionPtr session = process->newSession(...);
<span class="comment">// Send the request headers and request body data.</span>
session->sendHeaders(...);
session->sendBodyBlock(...);
<span class="comment">// Done sending data, so we close the writer channel.</span>
session->shutdownWriter();
<span class="comment">// Now read the HTTP response.</span>
<span class="keywordtype">string</span> responseData = readAllDataFromSocket(session->getReader());
<span class="comment">// Done reading data, so we close the reader channel.</span>
session->shutdownReader();
<span class="comment">// This session has now finished, so we close the session by resetting</span>
<span class="comment">// the smart pointer to NULL (thereby destroying the Session object).</span>
session.reset();
<span class="comment">// We can connect to a Process multiple times. Just make sure</span>
<span class="comment">// the previous session is closed.</span>
session = process->newSession(...);
</pre></div><p>
You <b>must</b> close a session when you no longer need it. If you call connect() without having properly closed a previous session, you might cause a deadlock because the application process may be waiting for you to close the previous session.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>closeCallback</em> </td><td>A function which will be called when the session has been closed. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>initiateNow</em> </td><td>Whether the session should be initiated immediately. If set to false then you must call <code>initiate()</code> on the session before it's usable. </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A smart pointer to a <a class="el" href="classPassenger_1_1Session.html" title="Represents a single request/response pair of an application process.">Session</a> object, which represents the created session. </dd></dl>
<dl class="post" compact><dt><b>Postcondition:</b></dt><dd>result->initiated() == initiateNow </dd></dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>Something went wrong during session initiation. </td></tr>
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1IOException.html" title="Represents an error that occured during an I/O operation.">IOException</a></em> </td><td>Something went wrong during session initiation. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="Process_8h-source.html">Process.h</a></ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Feb 21 12:22:48 2010 for Passenger by
<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>
|