passenger 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of passenger might be problematic. Click here for more details.
- data/Rakefile +8 -5
- data/bin/passenger-install-apache2-module +6 -1
- data/doc/ApplicationPool algorithm.txt +23 -5
- data/doc/Architectural overview.html +778 -0
- data/doc/Security of user switching support.html +1 -1
- data/doc/Users guide.html +113 -31
- data/doc/Users guide.txt +104 -10
- data/doc/cxxapi/ApplicationPoolServer_8h-source.html +683 -0
- data/doc/cxxapi/ApplicationPool_8h-source.html +224 -0
- data/doc/cxxapi/Application_8h-source.html +448 -0
- data/doc/cxxapi/Bucket_8h-source.html +61 -0
- data/doc/cxxapi/Configuration_8h-source.html +195 -0
- data/doc/cxxapi/DummySpawnManager_8h-source.html +126 -0
- data/doc/cxxapi/Exceptions_8h-source.html +244 -0
- data/doc/cxxapi/Hooks_8h-source.html +63 -0
- data/doc/cxxapi/Logging_8h-source.html +136 -0
- data/doc/cxxapi/MessageChannel_8h-source.html +524 -0
- data/doc/cxxapi/SpawnManager_8h-source.html +593 -0
- data/doc/cxxapi/StandardApplicationPool_8h-source.html +732 -0
- data/doc/cxxapi/System_8h-source.html +251 -0
- data/doc/cxxapi/Utils_8h-source.html +283 -0
- data/doc/cxxapi/annotated.html +59 -0
- data/doc/cxxapi/classClient-members.html +35 -0
- data/doc/cxxapi/classClient.html +117 -0
- data/doc/cxxapi/classDirectoryMapper-members.html +38 -0
- data/doc/cxxapi/classDirectoryMapper.html +203 -0
- data/doc/cxxapi/classHooks-members.html +33 -0
- data/doc/cxxapi/classHooks.html +43 -0
- data/doc/cxxapi/classPassenger_1_1Application-members.html +38 -0
- data/doc/cxxapi/classPassenger_1_1Application.html +229 -0
- data/doc/cxxapi/classPassenger_1_1ApplicationPool-members.html +41 -0
- data/doc/cxxapi/classPassenger_1_1ApplicationPool.html +359 -0
- data/doc/cxxapi/classPassenger_1_1ApplicationPoolServer-members.html +36 -0
- data/doc/cxxapi/classPassenger_1_1ApplicationPoolServer.html +225 -0
- data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.map +1 -0
- data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.md5 +1 -0
- data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1Application_1_1Session-members.html +43 -0
- data/doc/cxxapi/classPassenger_1_1Application_1_1Session.html +329 -0
- data/doc/cxxapi/classPassenger_1_1BusyException-members.html +33 -0
- data/doc/cxxapi/classPassenger_1_1BusyException.html +47 -0
- data/doc/cxxapi/classPassenger_1_1ConfigurationException-members.html +33 -0
- data/doc/cxxapi/classPassenger_1_1ConfigurationException.html +44 -0
- data/doc/cxxapi/classPassenger_1_1DummySpawnManager-members.html +33 -0
- data/doc/cxxapi/classPassenger_1_1DummySpawnManager.html +51 -0
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException-members.html +33 -0
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException.html +51 -0
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.map +1 -0
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.md5 +1 -0
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1FileSystemException-members.html +38 -0
- data/doc/cxxapi/classPassenger_1_1FileSystemException.html +61 -0
- data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.map +1 -0
- data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.md5 +1 -0
- data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1IOException-members.html +33 -0
- data/doc/cxxapi/classPassenger_1_1IOException.html +54 -0
- data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.map +1 -0
- data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.md5 +1 -0
- data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1MessageChannel-members.html +47 -0
- data/doc/cxxapi/classPassenger_1_1MessageChannel.html +591 -0
- data/doc/cxxapi/classPassenger_1_1SpawnException-members.html +35 -0
- data/doc/cxxapi/classPassenger_1_1SpawnException.html +77 -0
- data/doc/cxxapi/classPassenger_1_1SpawnManager-members.html +37 -0
- data/doc/cxxapi/classPassenger_1_1SpawnManager.html +255 -0
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool-members.html +43 -0
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool.html +400 -0
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.map +1 -0
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.md5 +1 -0
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1SystemException-members.html +37 -0
- data/doc/cxxapi/classPassenger_1_1SystemException.html +154 -0
- data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.map +1 -0
- data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.md5 +1 -0
- data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1TempFile-members.html +36 -0
- data/doc/cxxapi/classPassenger_1_1TempFile.html +128 -0
- data/doc/cxxapi/classPassenger_1_1Thread-members.html +35 -0
- data/doc/cxxapi/classPassenger_1_1Thread.html +100 -0
- data/doc/cxxapi/classboost_1_1this__thread_1_1disable__syscall__interruption-members.html +33 -0
- data/doc/cxxapi/classboost_1_1this__thread_1_1disable__syscall__interruption.html +46 -0
- data/doc/cxxapi/classboost_1_1this__thread_1_1enable__syscall__interruption-members.html +33 -0
- data/doc/cxxapi/classboost_1_1this__thread_1_1enable__syscall__interruption.html +44 -0
- data/doc/cxxapi/classboost_1_1this__thread_1_1restore__syscall__interruption-members.html +33 -0
- data/doc/cxxapi/classboost_1_1this__thread_1_1restore__syscall__interruption.html +44 -0
- data/doc/cxxapi/definitions_8h-source.html +28 -0
- data/doc/cxxapi/doxygen.css +433 -0
- data/doc/cxxapi/doxygen.png +0 -0
- data/doc/cxxapi/files.html +42 -0
- data/doc/cxxapi/ftv2blank.png +0 -0
- data/doc/cxxapi/ftv2doc.png +0 -0
- data/doc/cxxapi/ftv2folderclosed.png +0 -0
- data/doc/cxxapi/ftv2folderopen.png +0 -0
- data/doc/cxxapi/ftv2lastnode.png +0 -0
- data/doc/cxxapi/ftv2link.png +0 -0
- data/doc/cxxapi/ftv2mlastnode.png +0 -0
- data/doc/cxxapi/ftv2mnode.png +0 -0
- data/doc/cxxapi/ftv2node.png +0 -0
- data/doc/cxxapi/ftv2plastnode.png +0 -0
- data/doc/cxxapi/ftv2pnode.png +0 -0
- data/doc/cxxapi/ftv2vertline.png +0 -0
- data/doc/cxxapi/functions.html +215 -0
- data/doc/cxxapi/functions_func.html +210 -0
- data/doc/cxxapi/functions_type.html +46 -0
- data/doc/cxxapi/functions_vars.html +48 -0
- data/doc/cxxapi/graph_legend.dot +22 -0
- data/doc/cxxapi/graph_legend.html +87 -0
- data/doc/cxxapi/graph_legend.png +0 -0
- data/doc/cxxapi/group__Configuration.html +236 -0
- data/doc/cxxapi/group__Configuration.png +0 -0
- data/doc/cxxapi/group__Core.html +51 -0
- data/doc/cxxapi/group__Core.png +0 -0
- data/doc/cxxapi/group__Exceptions.html +43 -0
- data/doc/cxxapi/group__Hooks.html +46 -0
- data/doc/cxxapi/group__Hooks.png +0 -0
- data/doc/cxxapi/group__Support.html +406 -0
- data/doc/cxxapi/hierarchy.html +67 -0
- data/doc/cxxapi/index.html +11 -0
- data/doc/cxxapi/inherit__graph__0.map +1 -0
- data/doc/cxxapi/inherit__graph__0.md5 +1 -0
- data/doc/cxxapi/inherit__graph__0.png +0 -0
- data/doc/cxxapi/inherit__graph__1.map +1 -0
- data/doc/cxxapi/inherit__graph__1.md5 +1 -0
- data/doc/cxxapi/inherit__graph__1.png +0 -0
- data/doc/cxxapi/inherit__graph__10.map +1 -0
- data/doc/cxxapi/inherit__graph__10.md5 +1 -0
- data/doc/cxxapi/inherit__graph__10.png +0 -0
- data/doc/cxxapi/inherit__graph__11.map +1 -0
- data/doc/cxxapi/inherit__graph__11.md5 +1 -0
- data/doc/cxxapi/inherit__graph__11.png +0 -0
- data/doc/cxxapi/inherit__graph__12.map +1 -0
- data/doc/cxxapi/inherit__graph__12.md5 +1 -0
- data/doc/cxxapi/inherit__graph__12.png +0 -0
- data/doc/cxxapi/inherit__graph__13.map +1 -0
- data/doc/cxxapi/inherit__graph__13.md5 +1 -0
- data/doc/cxxapi/inherit__graph__13.png +0 -0
- data/doc/cxxapi/inherit__graph__14.map +2 -0
- data/doc/cxxapi/inherit__graph__14.md5 +1 -0
- data/doc/cxxapi/inherit__graph__14.png +0 -0
- data/doc/cxxapi/inherit__graph__15.map +1 -0
- data/doc/cxxapi/inherit__graph__15.md5 +1 -0
- data/doc/cxxapi/inherit__graph__15.png +0 -0
- data/doc/cxxapi/inherit__graph__16.map +1 -0
- data/doc/cxxapi/inherit__graph__16.md5 +1 -0
- data/doc/cxxapi/inherit__graph__16.png +0 -0
- data/doc/cxxapi/inherit__graph__17.map +1 -0
- data/doc/cxxapi/inherit__graph__17.md5 +1 -0
- data/doc/cxxapi/inherit__graph__17.png +0 -0
- data/doc/cxxapi/inherit__graph__18.map +1 -0
- data/doc/cxxapi/inherit__graph__18.md5 +1 -0
- data/doc/cxxapi/inherit__graph__18.png +0 -0
- data/doc/cxxapi/inherit__graph__19.map +2 -0
- data/doc/cxxapi/inherit__graph__19.md5 +1 -0
- data/doc/cxxapi/inherit__graph__19.png +0 -0
- data/doc/cxxapi/inherit__graph__2.map +1 -0
- data/doc/cxxapi/inherit__graph__2.md5 +1 -0
- data/doc/cxxapi/inherit__graph__2.png +0 -0
- data/doc/cxxapi/inherit__graph__20.map +1 -0
- data/doc/cxxapi/inherit__graph__20.md5 +1 -0
- data/doc/cxxapi/inherit__graph__20.png +0 -0
- data/doc/cxxapi/inherit__graph__21.map +1 -0
- data/doc/cxxapi/inherit__graph__21.md5 +1 -0
- data/doc/cxxapi/inherit__graph__21.png +0 -0
- data/doc/cxxapi/inherit__graph__3.map +1 -0
- data/doc/cxxapi/inherit__graph__3.md5 +1 -0
- data/doc/cxxapi/inherit__graph__3.png +0 -0
- data/doc/cxxapi/inherit__graph__4.map +1 -0
- data/doc/cxxapi/inherit__graph__4.md5 +1 -0
- data/doc/cxxapi/inherit__graph__4.png +0 -0
- data/doc/cxxapi/inherit__graph__5.map +1 -0
- data/doc/cxxapi/inherit__graph__5.md5 +1 -0
- data/doc/cxxapi/inherit__graph__5.png +0 -0
- data/doc/cxxapi/inherit__graph__6.map +1 -0
- data/doc/cxxapi/inherit__graph__6.md5 +1 -0
- data/doc/cxxapi/inherit__graph__6.png +0 -0
- data/doc/cxxapi/inherit__graph__7.map +1 -0
- data/doc/cxxapi/inherit__graph__7.md5 +1 -0
- data/doc/cxxapi/inherit__graph__7.png +0 -0
- data/doc/cxxapi/inherit__graph__8.map +1 -0
- data/doc/cxxapi/inherit__graph__8.md5 +1 -0
- data/doc/cxxapi/inherit__graph__8.png +0 -0
- data/doc/cxxapi/inherit__graph__9.map +2 -0
- data/doc/cxxapi/inherit__graph__9.md5 +1 -0
- data/doc/cxxapi/inherit__graph__9.png +0 -0
- data/doc/cxxapi/inherits.html +102 -0
- data/doc/cxxapi/main.html +27 -0
- data/doc/cxxapi/modules.html +34 -0
- data/doc/cxxapi/namespacePassenger.html +208 -0
- data/doc/cxxapi/namespacePassenger_1_1InterruptableCalls.html +43 -0
- data/doc/cxxapi/namespacemembers.html +70 -0
- data/doc/cxxapi/namespacemembers_func.html +66 -0
- data/doc/cxxapi/namespacemembers_type.html +46 -0
- data/doc/cxxapi/namespaces.html +35 -0
- data/doc/cxxapi/structPassenger_1_1AnythingToString-members.html +33 -0
- data/doc/cxxapi/structPassenger_1_1AnythingToString.html +49 -0
- data/doc/cxxapi/structPassenger_1_1AnythingToString_3_01vector_3_01string_01_4_01_4-members.html +33 -0
- data/doc/cxxapi/structPassenger_1_1AnythingToString_3_01vector_3_01string_01_4_01_4.html +49 -0
- data/doc/cxxapi/tab_b.gif +0 -0
- data/doc/cxxapi/tab_l.gif +0 -0
- data/doc/cxxapi/tab_r.gif +0 -0
- data/doc/cxxapi/tabs.css +102 -0
- data/doc/cxxapi/tree.html +167 -0
- data/doc/rdoc/classes/ConditionVariable.html +160 -0
- data/doc/rdoc/classes/Exception.html +120 -0
- data/doc/rdoc/classes/GC.html +113 -0
- data/doc/rdoc/classes/IO.html +150 -0
- data/doc/rdoc/classes/Passenger.html +136 -0
- data/doc/rdoc/classes/Passenger/AbstractRequestHandler.html +402 -0
- data/doc/rdoc/classes/Passenger/AbstractServer.html +649 -0
- data/doc/rdoc/classes/Passenger/AbstractServer/ServerAlreadyStarted.html +97 -0
- data/doc/rdoc/classes/Passenger/AbstractServer/ServerError.html +96 -0
- data/doc/rdoc/classes/Passenger/AbstractServer/ServerNotStarted.html +97 -0
- data/doc/rdoc/classes/Passenger/AbstractServer/UnknownMessage.html +96 -0
- data/doc/rdoc/classes/Passenger/AppInitError.html +137 -0
- data/doc/rdoc/classes/Passenger/Application.html +298 -0
- data/doc/rdoc/classes/Passenger/ConsoleTextTemplate.html +172 -0
- data/doc/rdoc/classes/Passenger/FrameworkInitError.html +143 -0
- data/doc/rdoc/classes/Passenger/HTMLTemplate.html +175 -0
- data/doc/rdoc/classes/Passenger/InitializationError.html +141 -0
- data/doc/rdoc/classes/Passenger/MessageChannel.html +488 -0
- data/doc/rdoc/classes/Passenger/NativeSupport.html +320 -0
- data/doc/rdoc/classes/Passenger/SpawnManager.html +375 -0
- data/doc/rdoc/classes/Passenger/UnknownError.html +125 -0
- data/doc/rdoc/classes/Passenger/Utils.html +578 -0
- data/doc/rdoc/classes/Passenger/VersionNotFound.html +140 -0
- data/doc/rdoc/classes/PlatformInfo.html +302 -0
- data/doc/rdoc/classes/RakeExtensions.html +197 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/DEVELOPERS_TXT.html +230 -0
- data/doc/rdoc/files/README.html +150 -0
- data/doc/rdoc/files/ext/passenger/native_support_c.html +92 -0
- data/doc/rdoc/files/lib/passenger/abstract_request_handler_rb.html +126 -0
- data/doc/rdoc/files/lib/passenger/abstract_server_rb.html +127 -0
- data/doc/rdoc/files/lib/passenger/application_rb.html +123 -0
- data/doc/rdoc/files/lib/passenger/console_text_template_rb.html +122 -0
- data/doc/rdoc/files/lib/passenger/constants_rb.html +114 -0
- data/doc/rdoc/files/lib/passenger/dependencies_rb.html +130 -0
- data/doc/rdoc/files/lib/passenger/exceptions_rb.html +118 -0
- data/doc/rdoc/files/lib/passenger/html_template_rb.html +122 -0
- data/doc/rdoc/files/lib/passenger/message_channel_rb.html +118 -0
- data/doc/rdoc/files/lib/passenger/platform_info_rb.html +122 -0
- data/doc/rdoc/files/lib/passenger/simple_benchmarking_rb.html +118 -0
- data/doc/rdoc/files/lib/passenger/spawn_manager_rb.html +139 -0
- data/doc/rdoc/files/lib/passenger/utils_rb.html +130 -0
- data/doc/rdoc/files/lib/rake/extensions_rb.html +122 -0
- data/doc/rdoc/fr_class_index.html +71 -0
- data/doc/rdoc/fr_file_index.html +63 -0
- data/doc/rdoc/fr_method_index.html +120 -0
- data/doc/rdoc/index.html +26 -0
- data/doc/rdoc/rdoc-style.css +187 -0
- data/ext/apache2/ApplicationPool.h +12 -0
- data/ext/apache2/ApplicationPoolServer.h +6 -0
- data/ext/apache2/ApplicationPoolServerExecutable.cpp +6 -0
- data/ext/apache2/Bucket.cpp +63 -69
- data/ext/apache2/Bucket.h +2 -0
- data/ext/apache2/Configuration.cpp +24 -0
- data/ext/apache2/Configuration.h +16 -1
- data/ext/apache2/Hooks.cpp +5 -3
- data/ext/apache2/StandardApplicationPool.h +30 -11
- data/lib/passenger/abstract_request_handler.rb +3 -0
- data/lib/passenger/abstract_server.rb +3 -3
- data/lib/passenger/application.rb +4 -2
- data/lib/passenger/dependencies.rb +10 -1
- data/lib/passenger/platform_info.rb +40 -1
- data/lib/passenger/rack/request_handler.rb +4 -2
- data/lib/passenger/railz/application_spawner.rb +7 -1
- data/lib/passenger/utils.rb +6 -8
- data/lib/rake/gempackagetask.rb +0 -6
- data/lib/rake/rdoctask.rb +84 -23
- data/test/ApplicationPoolTest.cpp +36 -0
- data/test/ruby/rails/minimal_spawner_spec.rb +8 -0
- data/test/ruby/utils_spec.rb +33 -0
- data/test/stub/rails_apps/foobar/config/environments/production.rb +0 -1
- metadata +262 -5
@@ -0,0 +1,649 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
<html>
|
6
|
+
<head>
|
7
|
+
<title>Class: Passenger::AbstractServer</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
9
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
10
|
+
|
11
|
+
<script language="JavaScript" type="text/javascript">
|
12
|
+
// <![CDATA[
|
13
|
+
|
14
|
+
function toggleSource( id )
|
15
|
+
{
|
16
|
+
var elem
|
17
|
+
var link
|
18
|
+
|
19
|
+
if( document.getElementById )
|
20
|
+
{
|
21
|
+
elem = document.getElementById( id )
|
22
|
+
link = document.getElementById( "l_" + id )
|
23
|
+
}
|
24
|
+
else if ( document.all )
|
25
|
+
{
|
26
|
+
elem = eval( "document.all." + id )
|
27
|
+
link = eval( "document.all.l_" + id )
|
28
|
+
}
|
29
|
+
else
|
30
|
+
return false;
|
31
|
+
|
32
|
+
if( elem.style.display == "block" )
|
33
|
+
{
|
34
|
+
elem.style.display = "none"
|
35
|
+
link.innerHTML = "show source"
|
36
|
+
}
|
37
|
+
else
|
38
|
+
{
|
39
|
+
elem.style.display = "block"
|
40
|
+
link.innerHTML = "hide source"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
function openCode( url )
|
45
|
+
{
|
46
|
+
window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
|
47
|
+
}
|
48
|
+
// ]]>
|
49
|
+
</script>
|
50
|
+
</head>
|
51
|
+
|
52
|
+
<body>
|
53
|
+
<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
|
54
|
+
<td class="file-title"><span class="file-title-prefix">Class</span><br />Passenger::AbstractServer</td>
|
55
|
+
<td align="right">
|
56
|
+
<table cellspacing="0" cellpadding="2">
|
57
|
+
<tr valign="top">
|
58
|
+
<td>In:</td>
|
59
|
+
<td>
|
60
|
+
<a href="../../files/lib/passenger/abstract_server_rb.html">lib/passenger/abstract_server.rb</a>
|
61
|
+
</td>
|
62
|
+
</tr>
|
63
|
+
<tr>
|
64
|
+
<td>Parent:</td>
|
65
|
+
<td>
|
66
|
+
Object
|
67
|
+
</td>
|
68
|
+
</tr>
|
69
|
+
</table>
|
70
|
+
</td>
|
71
|
+
</tr>
|
72
|
+
</table>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
<div id="content">
|
77
|
+
|
78
|
+
<div class="description"><p>
|
79
|
+
An abstract base class for a <a
|
80
|
+
href="AbstractServer.html#M000063">server</a>, with the following
|
81
|
+
properties:
|
82
|
+
</p>
|
83
|
+
<ul>
|
84
|
+
<li>The <a href="AbstractServer.html#M000063">server</a> has exactly one <a
|
85
|
+
href="AbstractServer.html#M000064">client</a>, and is connected to that <a
|
86
|
+
href="AbstractServer.html#M000064">client</a> at all times. The <a
|
87
|
+
href="AbstractServer.html#M000063">server</a> will quit when the connection
|
88
|
+
closes.
|
89
|
+
|
90
|
+
</li>
|
91
|
+
<li>The <a href="AbstractServer.html#M000063">server</a>‘s main loop may
|
92
|
+
be run in a child process (and so is asynchronous from the main process).
|
93
|
+
|
94
|
+
</li>
|
95
|
+
<li>One can communicate with the <a
|
96
|
+
href="AbstractServer.html#M000063">server</a> through discrete messages (as
|
97
|
+
opposed to byte streams).
|
98
|
+
|
99
|
+
</li>
|
100
|
+
<li>The <a href="AbstractServer.html#M000063">server</a> can pass file
|
101
|
+
descriptors (<a href="../IO.html">IO</a> objects) back to the <a
|
102
|
+
href="AbstractServer.html#M000064">client</a>.
|
103
|
+
|
104
|
+
</li>
|
105
|
+
</ul>
|
106
|
+
<p>
|
107
|
+
A message is just an ordered list of strings. The first element in the
|
108
|
+
message is the _message name_.
|
109
|
+
</p>
|
110
|
+
<p>
|
111
|
+
The <a href="AbstractServer.html#M000063">server</a> will also reset all
|
112
|
+
signal handlers (in the child process). That is, it will respond to all
|
113
|
+
signals in the default manner. The only exception is SIGHUP, which is
|
114
|
+
ignored. One may define additional signal handlers using <a
|
115
|
+
href="AbstractServer.html#M000062">define_signal_handler</a>().
|
116
|
+
</p>
|
117
|
+
<p>
|
118
|
+
Before an <a href="AbstractServer.html">AbstractServer</a> can be used, it
|
119
|
+
must first be started by calling <a
|
120
|
+
href="AbstractServer.html#M000053">start</a>(). When it is no longer
|
121
|
+
needed, <a href="AbstractServer.html#M000055">stop</a>() should be called.
|
122
|
+
</p>
|
123
|
+
<p>
|
124
|
+
Here‘s an example on using <a
|
125
|
+
href="AbstractServer.html">AbstractServer</a>:
|
126
|
+
</p>
|
127
|
+
<pre>
|
128
|
+
class MyServer < Passenger::AbstractServer
|
129
|
+
def initialize
|
130
|
+
super()
|
131
|
+
define_message_handler(:hello, :handle_hello)
|
132
|
+
end
|
133
|
+
|
134
|
+
def hello(first_name, last_name)
|
135
|
+
send_to_server('hello', first_name, last_name)
|
136
|
+
reply, pointless_number = recv_from_server
|
137
|
+
puts "The server said: #{reply}"
|
138
|
+
puts "In addition, it sent this pointless number: #{pointless_number}"
|
139
|
+
end
|
140
|
+
|
141
|
+
private
|
142
|
+
def handle_hello(first_name, last_name)
|
143
|
+
send_to_client("Hello #{first_name} #{last_name}, how are you?", 1234)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
server = MyServer.new
|
148
|
+
server.start
|
149
|
+
server.hello("Joe", "Dalton")
|
150
|
+
server.stop
|
151
|
+
</pre>
|
152
|
+
</div>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<div class="sectiontitle">Methods</div>
|
157
|
+
<ul>
|
158
|
+
<li><a href="#M000058">before_fork</a></li>
|
159
|
+
<li><a href="#M000064">client</a></li>
|
160
|
+
<li><a href="#M000061">define_message_handler</a></li>
|
161
|
+
<li><a href="#M000062">define_signal_handler</a></li>
|
162
|
+
<li><a href="#M000060">finalize_server</a></li>
|
163
|
+
<li><a href="#M000059">initialize_server</a></li>
|
164
|
+
<li><a href="#M000052">new</a></li>
|
165
|
+
<li><a href="#M000065">quit_main</a></li>
|
166
|
+
<li><a href="#M000063">server</a></li>
|
167
|
+
<li><a href="#M000057">server_pid</a></li>
|
168
|
+
<li><a href="#M000053">start</a></li>
|
169
|
+
<li><a href="#M000054">start_synchronously</a></li>
|
170
|
+
<li><a href="#M000056">started?</a></li>
|
171
|
+
<li><a href="#M000055">stop</a></li>
|
172
|
+
</ul>
|
173
|
+
|
174
|
+
<div class="sectiontitle">Included Modules</div>
|
175
|
+
<ul>
|
176
|
+
<li><a href="Utils.html">Utils</a></li>
|
177
|
+
</ul>
|
178
|
+
|
179
|
+
|
180
|
+
<div class="sectiontitle">Classes and Modules</div>
|
181
|
+
Class <a href="AbstractServer/ServerAlreadyStarted.html" class="link">Passenger::AbstractServer::ServerAlreadyStarted</a><br />
|
182
|
+
Class <a href="AbstractServer/ServerError.html" class="link">Passenger::AbstractServer::ServerError</a><br />
|
183
|
+
Class <a href="AbstractServer/ServerNotStarted.html" class="link">Passenger::AbstractServer::ServerNotStarted</a><br />
|
184
|
+
Class <a href="AbstractServer/UnknownMessage.html" class="link">Passenger::AbstractServer::UnknownMessage</a><br />
|
185
|
+
|
186
|
+
|
187
|
+
<div class="sectiontitle">Constants</div>
|
188
|
+
<table border='0' cellpadding='5'>
|
189
|
+
<tr valign='top'>
|
190
|
+
<td class="attr-name">SERVER_TERMINATION_SIGNAL</td>
|
191
|
+
<td>=</td>
|
192
|
+
<td class="attr-value">"SIGTERM"</td>
|
193
|
+
</tr>
|
194
|
+
</table>
|
195
|
+
|
196
|
+
|
197
|
+
<div class="sectiontitle">Public Class methods</div>
|
198
|
+
<div class="method">
|
199
|
+
<div class="title">
|
200
|
+
<a name="M000052"></a><b>new</b>()
|
201
|
+
</div>
|
202
|
+
<div class="sourcecode">
|
203
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000052_source')" id="l_M000052_source">show source</a> ]</p>
|
204
|
+
<div id="M000052_source" class="dyn-source">
|
205
|
+
<pre>
|
206
|
+
<span class="ruby-comment cmt"># File lib/passenger/abstract_server.rb, line 91</span>
|
207
|
+
91: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
|
208
|
+
92: <span class="ruby-ivar">@done</span> = <span class="ruby-keyword kw">false</span>
|
209
|
+
93: <span class="ruby-ivar">@message_handlers</span> = {}
|
210
|
+
94: <span class="ruby-ivar">@signal_handlers</span> = {}
|
211
|
+
95: <span class="ruby-ivar">@orig_signal_handlers</span> = {}
|
212
|
+
96: <span class="ruby-keyword kw">end</span>
|
213
|
+
</pre>
|
214
|
+
</div>
|
215
|
+
</div>
|
216
|
+
</div>
|
217
|
+
<div class="sectiontitle">Public Instance methods</div>
|
218
|
+
<div class="method">
|
219
|
+
<div class="title">
|
220
|
+
<a name="M000057"></a><b>server_pid</b>()
|
221
|
+
</div>
|
222
|
+
<div class="description">
|
223
|
+
<p>
|
224
|
+
Return the PID of the started <a
|
225
|
+
href="AbstractServer.html#M000063">server</a>. This is only valid if <a
|
226
|
+
href="AbstractServer.html#M000053">start</a>() has been called.
|
227
|
+
</p>
|
228
|
+
</div>
|
229
|
+
<div class="sourcecode">
|
230
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000057_source')" id="l_M000057_source">show source</a> ]</p>
|
231
|
+
<div id="M000057_source" class="dyn-source">
|
232
|
+
<pre>
|
233
|
+
<span class="ruby-comment cmt"># File lib/passenger/abstract_server.rb, line 216</span>
|
234
|
+
216: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">server_pid</span>
|
235
|
+
217: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@pid</span>
|
236
|
+
218: <span class="ruby-keyword kw">end</span>
|
237
|
+
</pre>
|
238
|
+
</div>
|
239
|
+
</div>
|
240
|
+
</div>
|
241
|
+
<div class="method">
|
242
|
+
<div class="title">
|
243
|
+
<a name="M000053"></a><b>start</b>()
|
244
|
+
</div>
|
245
|
+
<div class="description">
|
246
|
+
<p>
|
247
|
+
Start the <a href="AbstractServer.html#M000063">server</a>. This method
|
248
|
+
does not block since the <a href="AbstractServer.html#M000063">server</a>
|
249
|
+
runs asynchronously from the current process.
|
250
|
+
</p>
|
251
|
+
<p>
|
252
|
+
You may only call this method if the <a
|
253
|
+
href="AbstractServer.html#M000063">server</a> is not already started.
|
254
|
+
Otherwise, a <a
|
255
|
+
href="AbstractServer/ServerAlreadyStarted.html">ServerAlreadyStarted</a>
|
256
|
+
will be raised.
|
257
|
+
</p>
|
258
|
+
<p>
|
259
|
+
Derived classes may raise additional exceptions.
|
260
|
+
</p>
|
261
|
+
</div>
|
262
|
+
<div class="sourcecode">
|
263
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000053_source')" id="l_M000053_source">show source</a> ]</p>
|
264
|
+
<div id="M000053_source" class="dyn-source">
|
265
|
+
<pre>
|
266
|
+
<span class="ruby-comment cmt"># File lib/passenger/abstract_server.rb, line 105</span>
|
267
|
+
105: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start</span>
|
268
|
+
106: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">started?</span>
|
269
|
+
107: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ServerAlreadyStarted</span>, <span class="ruby-value str">"Server is already started"</span>
|
270
|
+
108: <span class="ruby-keyword kw">end</span>
|
271
|
+
109:
|
272
|
+
110: <span class="ruby-ivar">@parent_socket</span>, <span class="ruby-ivar">@child_socket</span> = <span class="ruby-constant">UNIXSocket</span>.<span class="ruby-identifier">pair</span>
|
273
|
+
111: <span class="ruby-identifier">before_fork</span>
|
274
|
+
112: <span class="ruby-ivar">@pid</span> = <span class="ruby-identifier">fork</span> <span class="ruby-keyword kw">do</span>
|
275
|
+
113: <span class="ruby-keyword kw">begin</span>
|
276
|
+
114: <span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">sync</span> = <span class="ruby-keyword kw">true</span>
|
277
|
+
115: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">sync</span> = <span class="ruby-keyword kw">true</span>
|
278
|
+
116: <span class="ruby-ivar">@parent_socket</span>.<span class="ruby-identifier">close</span>
|
279
|
+
117:
|
280
|
+
118: <span class="ruby-comment cmt"># During Passenger's early days, we used to close file descriptors based</span>
|
281
|
+
119: <span class="ruby-comment cmt"># on a white list of file descriptors. That proved to be way too fragile:</span>
|
282
|
+
120: <span class="ruby-comment cmt"># too many file descriptors are being left open even though they shouldn't</span>
|
283
|
+
121: <span class="ruby-comment cmt"># be. So now we close file descriptors based on a black list.</span>
|
284
|
+
122: <span class="ruby-identifier">file_descriptors_to_leave_open</span> = [<span class="ruby-value">0</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-ivar">@child_socket</span>.<span class="ruby-identifier">fileno</span>]
|
285
|
+
123: <span class="ruby-constant">NativeSupport</span>.<span class="ruby-identifier">close_all_file_descriptors</span>(<span class="ruby-identifier">file_descriptors_to_leave_open</span>)
|
286
|
+
124: <span class="ruby-comment cmt"># In addition to closing the file descriptors, one must also close</span>
|
287
|
+
125: <span class="ruby-comment cmt"># the associated IO objects. This is to prevent IO.close from</span>
|
288
|
+
126: <span class="ruby-comment cmt"># double-closing already closed file descriptors.</span>
|
289
|
+
127: <span class="ruby-identifier">close_all_io_objects_for_fds</span>(<span class="ruby-identifier">file_descriptors_to_leave_open</span>)
|
290
|
+
128:
|
291
|
+
129: <span class="ruby-comment cmt"># At this point, RubyGems might have open file handles for which</span>
|
292
|
+
130: <span class="ruby-comment cmt"># the associated file descriptors have just been closed. This can</span>
|
293
|
+
131: <span class="ruby-comment cmt"># result in mysterious 'EBADFD' errors. So we force RubyGems to</span>
|
294
|
+
132: <span class="ruby-comment cmt"># clear all open file handles.</span>
|
295
|
+
133: <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">clear_paths</span>
|
296
|
+
134:
|
297
|
+
135: <span class="ruby-identifier">start_synchronously</span>(<span class="ruby-ivar">@child_socket</span>)
|
298
|
+
136: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Interrupt</span>
|
299
|
+
137: <span class="ruby-comment cmt"># Do nothing.</span>
|
300
|
+
138: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SignalException</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">signal</span>
|
301
|
+
139: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">signal</span>.<span class="ruby-identifier">message</span> <span class="ruby-operator">==</span> <span class="ruby-constant">SERVER_TERMINATION_SIGNAL</span>
|
302
|
+
140: <span class="ruby-comment cmt"># Do nothing.</span>
|
303
|
+
141: <span class="ruby-keyword kw">else</span>
|
304
|
+
142: <span class="ruby-identifier">print_exception</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">signal</span>)
|
305
|
+
143: <span class="ruby-keyword kw">end</span>
|
306
|
+
144: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
307
|
+
145: <span class="ruby-identifier">print_exception</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">e</span>)
|
308
|
+
146: <span class="ruby-keyword kw">ensure</span>
|
309
|
+
147: <span class="ruby-identifier">exit!</span>
|
310
|
+
148: <span class="ruby-keyword kw">end</span>
|
311
|
+
149: <span class="ruby-keyword kw">end</span>
|
312
|
+
150: <span class="ruby-ivar">@child_socket</span>.<span class="ruby-identifier">close</span>
|
313
|
+
151: <span class="ruby-ivar">@parent_channel</span> = <span class="ruby-constant">MessageChannel</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@parent_socket</span>)
|
314
|
+
152: <span class="ruby-keyword kw">end</span>
|
315
|
+
</pre>
|
316
|
+
</div>
|
317
|
+
</div>
|
318
|
+
</div>
|
319
|
+
<div class="method">
|
320
|
+
<div class="title">
|
321
|
+
<a name="M000054"></a><b>start_synchronously</b>(socket)
|
322
|
+
</div>
|
323
|
+
<div class="description">
|
324
|
+
<p>
|
325
|
+
Start the <a href="AbstractServer.html#M000063">server</a>, but in the
|
326
|
+
current process instead of in a child process. This method blocks until the
|
327
|
+
<a href="AbstractServer.html#M000063">server</a>‘s main loop has
|
328
|
+
ended.
|
329
|
+
</p>
|
330
|
+
<p>
|
331
|
+
<em>socket</em> is the socket that the <a
|
332
|
+
href="AbstractServer.html#M000063">server</a> should listen on. The <a
|
333
|
+
href="AbstractServer.html#M000063">server</a> main loop will end if the
|
334
|
+
socket has been closed.
|
335
|
+
</p>
|
336
|
+
<p>
|
337
|
+
All hooks will be called, except <a
|
338
|
+
href="AbstractServer.html#M000058">before_fork</a>().
|
339
|
+
</p>
|
340
|
+
</div>
|
341
|
+
<div class="sourcecode">
|
342
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000054_source')" id="l_M000054_source">show source</a> ]</p>
|
343
|
+
<div id="M000054_source" class="dyn-source">
|
344
|
+
<pre>
|
345
|
+
<span class="ruby-comment cmt"># File lib/passenger/abstract_server.rb, line 161</span>
|
346
|
+
161: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start_synchronously</span>(<span class="ruby-identifier">socket</span>)
|
347
|
+
162: <span class="ruby-ivar">@child_socket</span> = <span class="ruby-identifier">socket</span>
|
348
|
+
163: <span class="ruby-ivar">@child_channel</span> = <span class="ruby-constant">MessageChannel</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">socket</span>)
|
349
|
+
164: <span class="ruby-keyword kw">begin</span>
|
350
|
+
165: <span class="ruby-identifier">reset_signal_handlers</span>
|
351
|
+
166: <span class="ruby-identifier">initialize_server</span>
|
352
|
+
167: <span class="ruby-keyword kw">begin</span>
|
353
|
+
168: <span class="ruby-identifier">main_loop</span>
|
354
|
+
169: <span class="ruby-keyword kw">ensure</span>
|
355
|
+
170: <span class="ruby-identifier">finalize_server</span>
|
356
|
+
171: <span class="ruby-keyword kw">end</span>
|
357
|
+
172: <span class="ruby-keyword kw">ensure</span>
|
358
|
+
173: <span class="ruby-identifier">revert_signal_handlers</span>
|
359
|
+
174: <span class="ruby-keyword kw">end</span>
|
360
|
+
175: <span class="ruby-keyword kw">end</span>
|
361
|
+
</pre>
|
362
|
+
</div>
|
363
|
+
</div>
|
364
|
+
</div>
|
365
|
+
<div class="method">
|
366
|
+
<div class="title">
|
367
|
+
<a name="M000056"></a><b>started?</b>()
|
368
|
+
</div>
|
369
|
+
<div class="description">
|
370
|
+
<p>
|
371
|
+
Return whether the <a href="AbstractServer.html#M000063">server</a> has
|
372
|
+
been started.
|
373
|
+
</p>
|
374
|
+
</div>
|
375
|
+
<div class="sourcecode">
|
376
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000056_source')" id="l_M000056_source">show source</a> ]</p>
|
377
|
+
<div id="M000056_source" class="dyn-source">
|
378
|
+
<pre>
|
379
|
+
<span class="ruby-comment cmt"># File lib/passenger/abstract_server.rb, line 211</span>
|
380
|
+
211: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">started?</span>
|
381
|
+
212: <span class="ruby-keyword kw">return</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@parent_channel</span>.<span class="ruby-identifier">nil?</span>
|
382
|
+
213: <span class="ruby-keyword kw">end</span>
|
383
|
+
</pre>
|
384
|
+
</div>
|
385
|
+
</div>
|
386
|
+
</div>
|
387
|
+
<div class="method">
|
388
|
+
<div class="title">
|
389
|
+
<a name="M000055"></a><b>stop</b>()
|
390
|
+
</div>
|
391
|
+
<div class="description">
|
392
|
+
<p>
|
393
|
+
Stop the <a href="AbstractServer.html#M000063">server</a>. The <a
|
394
|
+
href="AbstractServer.html#M000063">server</a> will quit as soon as
|
395
|
+
possible. This method waits until the <a
|
396
|
+
href="AbstractServer.html#M000063">server</a> has been stopped.
|
397
|
+
</p>
|
398
|
+
<p>
|
399
|
+
When calling this method, the <a
|
400
|
+
href="AbstractServer.html#M000063">server</a> must already be started. If
|
401
|
+
not, a <a href="AbstractServer/ServerNotStarted.html">ServerNotStarted</a>
|
402
|
+
will be raised.
|
403
|
+
</p>
|
404
|
+
</div>
|
405
|
+
<div class="sourcecode">
|
406
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000055_source')" id="l_M000055_source">show source</a> ]</p>
|
407
|
+
<div id="M000055_source" class="dyn-source">
|
408
|
+
<pre>
|
409
|
+
<span class="ruby-comment cmt"># File lib/passenger/abstract_server.rb, line 182</span>
|
410
|
+
182: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stop</span>
|
411
|
+
183: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">started?</span>
|
412
|
+
184: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ServerNotStarted</span>, <span class="ruby-value str">"Server is not started"</span>
|
413
|
+
185: <span class="ruby-keyword kw">end</span>
|
414
|
+
186:
|
415
|
+
187: <span class="ruby-ivar">@parent_socket</span>.<span class="ruby-identifier">close</span>
|
416
|
+
188: <span class="ruby-ivar">@parent_channel</span> = <span class="ruby-keyword kw">nil</span>
|
417
|
+
189:
|
418
|
+
190: <span class="ruby-comment cmt"># Wait at most 3 seconds for server to exit. If it doesn't do that,</span>
|
419
|
+
191: <span class="ruby-comment cmt"># we kill it. If that doesn't work either, we kill it forcefully with</span>
|
420
|
+
192: <span class="ruby-comment cmt"># SIGKILL.</span>
|
421
|
+
193: <span class="ruby-keyword kw">begin</span>
|
422
|
+
194: <span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-identifier">timeout</span>(<span class="ruby-value">3</span>) <span class="ruby-keyword kw">do</span>
|
423
|
+
195: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">waitpid</span>(<span class="ruby-ivar">@pid</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
424
|
+
196: <span class="ruby-keyword kw">end</span>
|
425
|
+
197: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>
|
426
|
+
198: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">kill</span>(<span class="ruby-constant">SERVER_TERMINATION_SIGNAL</span>, <span class="ruby-ivar">@pid</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
427
|
+
199: <span class="ruby-keyword kw">begin</span>
|
428
|
+
200: <span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-identifier">timeout</span>(<span class="ruby-value">3</span>) <span class="ruby-keyword kw">do</span>
|
429
|
+
201: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">waitpid</span>(<span class="ruby-ivar">@pid</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
430
|
+
202: <span class="ruby-keyword kw">end</span>
|
431
|
+
203: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>
|
432
|
+
204: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">kill</span>(<span class="ruby-value str">'SIGKILL'</span>, <span class="ruby-ivar">@pid</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
433
|
+
205: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">waitpid</span>(<span class="ruby-ivar">@pid</span>, <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-constant">WNOHANG</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
434
|
+
206: <span class="ruby-keyword kw">end</span>
|
435
|
+
207: <span class="ruby-keyword kw">end</span>
|
436
|
+
208: <span class="ruby-keyword kw">end</span>
|
437
|
+
</pre>
|
438
|
+
</div>
|
439
|
+
</div>
|
440
|
+
</div>
|
441
|
+
<div class="sectiontitle">Protected Instance methods</div>
|
442
|
+
<div class="method">
|
443
|
+
<div class="title">
|
444
|
+
<a name="M000058"></a><b>before_fork</b>()
|
445
|
+
</div>
|
446
|
+
<div class="description">
|
447
|
+
<p>
|
448
|
+
A hook which is called when the <a
|
449
|
+
href="AbstractServer.html#M000063">server</a> is being started, just before
|
450
|
+
forking a <a href="AbstractServer.html#M000052">new</a> process. The
|
451
|
+
default implementation does nothing, this method is supposed to be
|
452
|
+
overrided by child classes.
|
453
|
+
</p>
|
454
|
+
</div>
|
455
|
+
<div class="sourcecode">
|
456
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000058_source')" id="l_M000058_source">show source</a> ]</p>
|
457
|
+
<div id="M000058_source" class="dyn-source">
|
458
|
+
<pre>
|
459
|
+
<span class="ruby-comment cmt"># File lib/passenger/abstract_server.rb, line 223</span>
|
460
|
+
223: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">before_fork</span>
|
461
|
+
224: <span class="ruby-keyword kw">end</span>
|
462
|
+
</pre>
|
463
|
+
</div>
|
464
|
+
</div>
|
465
|
+
</div>
|
466
|
+
<div class="method">
|
467
|
+
<div class="title">
|
468
|
+
<a name="M000064"></a><b>client</b>()
|
469
|
+
</div>
|
470
|
+
<div class="description">
|
471
|
+
<p>
|
472
|
+
Return the communication channel with the <a
|
473
|
+
href="AbstractServer.html#M000064">client</a> (i.e. the parent process that
|
474
|
+
started the <a href="AbstractServer.html#M000063">server</a>). This is a <a
|
475
|
+
href="MessageChannel.html">MessageChannel</a> object.
|
476
|
+
</p>
|
477
|
+
</div>
|
478
|
+
<div class="sourcecode">
|
479
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000064_source')" id="l_M000064_source">show source</a> ]</p>
|
480
|
+
<div id="M000064_source" class="dyn-source">
|
481
|
+
<pre>
|
482
|
+
<span class="ruby-comment cmt"># File lib/passenger/abstract_server.rb, line 268</span>
|
483
|
+
268: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">client</span>
|
484
|
+
269: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@child_channel</span>
|
485
|
+
270: <span class="ruby-keyword kw">end</span>
|
486
|
+
</pre>
|
487
|
+
</div>
|
488
|
+
</div>
|
489
|
+
</div>
|
490
|
+
<div class="method">
|
491
|
+
<div class="title">
|
492
|
+
<a name="M000061"></a><b>define_message_handler</b>(message_name, handler)
|
493
|
+
</div>
|
494
|
+
<div class="description">
|
495
|
+
<p>
|
496
|
+
Define a handler for a message. <em>message_name</em> is the name of the
|
497
|
+
message to handle, and <em>handler</em> is the name of a method to be
|
498
|
+
called (this may either be a String or a Symbol).
|
499
|
+
</p>
|
500
|
+
<p>
|
501
|
+
A message is just a list of strings, and so <em>handler</em> will be called
|
502
|
+
with the message as its arguments, excluding the first element. See also
|
503
|
+
the example in the class description.
|
504
|
+
</p>
|
505
|
+
</div>
|
506
|
+
<div class="sourcecode">
|
507
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000061_source')" id="l_M000061_source">show source</a> ]</p>
|
508
|
+
<div id="M000061_source" class="dyn-source">
|
509
|
+
<pre>
|
510
|
+
<span class="ruby-comment cmt"># File lib/passenger/abstract_server.rb, line 243</span>
|
511
|
+
243: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">define_message_handler</span>(<span class="ruby-identifier">message_name</span>, <span class="ruby-identifier">handler</span>)
|
512
|
+
244: <span class="ruby-ivar">@message_handlers</span>[<span class="ruby-identifier">message_name</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">handler</span>
|
513
|
+
245: <span class="ruby-keyword kw">end</span>
|
514
|
+
</pre>
|
515
|
+
</div>
|
516
|
+
</div>
|
517
|
+
</div>
|
518
|
+
<div class="method">
|
519
|
+
<div class="title">
|
520
|
+
<a name="M000062"></a><b>define_signal_handler</b>(signal, handler)
|
521
|
+
</div>
|
522
|
+
<div class="description">
|
523
|
+
<p>
|
524
|
+
Define a handler for a signal.
|
525
|
+
</p>
|
526
|
+
</div>
|
527
|
+
<div class="sourcecode">
|
528
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000062_source')" id="l_M000062_source">show source</a> ]</p>
|
529
|
+
<div id="M000062_source" class="dyn-source">
|
530
|
+
<pre>
|
531
|
+
<span class="ruby-comment cmt"># File lib/passenger/abstract_server.rb, line 248</span>
|
532
|
+
248: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">define_signal_handler</span>(<span class="ruby-identifier">signal</span>, <span class="ruby-identifier">handler</span>)
|
533
|
+
249: <span class="ruby-ivar">@signal_handlers</span>[<span class="ruby-identifier">signal</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">handler</span>
|
534
|
+
250: <span class="ruby-keyword kw">end</span>
|
535
|
+
</pre>
|
536
|
+
</div>
|
537
|
+
</div>
|
538
|
+
</div>
|
539
|
+
<div class="method">
|
540
|
+
<div class="title">
|
541
|
+
<a name="M000060"></a><b>finalize_server</b>()
|
542
|
+
</div>
|
543
|
+
<div class="description">
|
544
|
+
<p>
|
545
|
+
A hook which is called when the <a
|
546
|
+
href="AbstractServer.html#M000063">server</a> is being stopped. This is
|
547
|
+
called in the child process, after the main loop has been left. The default
|
548
|
+
implementation does nothing, this method is supposed to be overrided by
|
549
|
+
child classes.
|
550
|
+
</p>
|
551
|
+
</div>
|
552
|
+
<div class="sourcecode">
|
553
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000060_source')" id="l_M000060_source">show source</a> ]</p>
|
554
|
+
<div id="M000060_source" class="dyn-source">
|
555
|
+
<pre>
|
556
|
+
<span class="ruby-comment cmt"># File lib/passenger/abstract_server.rb, line 235</span>
|
557
|
+
235: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">finalize_server</span>
|
558
|
+
236: <span class="ruby-keyword kw">end</span>
|
559
|
+
</pre>
|
560
|
+
</div>
|
561
|
+
</div>
|
562
|
+
</div>
|
563
|
+
<div class="method">
|
564
|
+
<div class="title">
|
565
|
+
<a name="M000059"></a><b>initialize_server</b>()
|
566
|
+
</div>
|
567
|
+
<div class="description">
|
568
|
+
<p>
|
569
|
+
A hook which is called when the <a
|
570
|
+
href="AbstractServer.html#M000063">server</a> is being started. This is
|
571
|
+
called in the child process, before the main loop is entered. The default
|
572
|
+
implementation does nothing, this method is supposed to be overrided by
|
573
|
+
child classes.
|
574
|
+
</p>
|
575
|
+
</div>
|
576
|
+
<div class="sourcecode">
|
577
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000059_source')" id="l_M000059_source">show source</a> ]</p>
|
578
|
+
<div id="M000059_source" class="dyn-source">
|
579
|
+
<pre>
|
580
|
+
<span class="ruby-comment cmt"># File lib/passenger/abstract_server.rb, line 229</span>
|
581
|
+
229: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_server</span>
|
582
|
+
230: <span class="ruby-keyword kw">end</span>
|
583
|
+
</pre>
|
584
|
+
</div>
|
585
|
+
</div>
|
586
|
+
</div>
|
587
|
+
<div class="method">
|
588
|
+
<div class="title">
|
589
|
+
<a name="M000065"></a><b>quit_main</b>()
|
590
|
+
</div>
|
591
|
+
<div class="description">
|
592
|
+
<p>
|
593
|
+
Tell the main loop to <a href="AbstractServer.html#M000055">stop</a> as
|
594
|
+
soon as possible.
|
595
|
+
</p>
|
596
|
+
</div>
|
597
|
+
<div class="sourcecode">
|
598
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000065_source')" id="l_M000065_source">show source</a> ]</p>
|
599
|
+
<div id="M000065_source" class="dyn-source">
|
600
|
+
<pre>
|
601
|
+
<span class="ruby-comment cmt"># File lib/passenger/abstract_server.rb, line 273</span>
|
602
|
+
273: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quit_main</span>
|
603
|
+
274: <span class="ruby-ivar">@done</span> = <span class="ruby-keyword kw">true</span>
|
604
|
+
275: <span class="ruby-keyword kw">end</span>
|
605
|
+
</pre>
|
606
|
+
</div>
|
607
|
+
</div>
|
608
|
+
</div>
|
609
|
+
<div class="method">
|
610
|
+
<div class="title">
|
611
|
+
<a name="M000063"></a><b>server</b>()
|
612
|
+
</div>
|
613
|
+
<div class="description">
|
614
|
+
<p>
|
615
|
+
Return the communication channel with the <a
|
616
|
+
href="AbstractServer.html#M000063">server</a>. This is a <a
|
617
|
+
href="MessageChannel.html">MessageChannel</a> object.
|
618
|
+
</p>
|
619
|
+
<p>
|
620
|
+
Raises <a href="AbstractServer/ServerNotStarted.html">ServerNotStarted</a>
|
621
|
+
if the <a href="AbstractServer.html#M000063">server</a> hasn‘t been
|
622
|
+
started yet.
|
623
|
+
</p>
|
624
|
+
<p>
|
625
|
+
This method may only be called in the parent process, and not in the
|
626
|
+
started <a href="AbstractServer.html#M000063">server</a> process.
|
627
|
+
</p>
|
628
|
+
</div>
|
629
|
+
<div class="sourcecode">
|
630
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000063_source')" id="l_M000063_source">show source</a> ]</p>
|
631
|
+
<div id="M000063_source" class="dyn-source">
|
632
|
+
<pre>
|
633
|
+
<span class="ruby-comment cmt"># File lib/passenger/abstract_server.rb, line 259</span>
|
634
|
+
259: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">server</span>
|
635
|
+
260: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">started?</span>
|
636
|
+
261: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ServerNotStarted</span>, <span class="ruby-value str">"Server hasn't been started yet. Please call start() first."</span>
|
637
|
+
262: <span class="ruby-keyword kw">end</span>
|
638
|
+
263: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@parent_channel</span>
|
639
|
+
264: <span class="ruby-keyword kw">end</span>
|
640
|
+
</pre>
|
641
|
+
</div>
|
642
|
+
</div>
|
643
|
+
</div>
|
644
|
+
</div>
|
645
|
+
|
646
|
+
</div>
|
647
|
+
|
648
|
+
</body>
|
649
|
+
</html>
|