colouringcode-passenger 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS +129 -0
- data/Rakefile +2 -2
- data/bin/passenger-install-apache2-module +1 -0
- data/bin/passenger-install-nginx-module +4 -2
- data/ext/apache2/Hooks.cpp +4 -2
- data/ext/common/ApplicationPoolServer.h +1 -1
- data/ext/common/ApplicationPoolServerExecutable.cpp +1 -1
- data/ext/common/MessageChannel.h +48 -4
- data/ext/common/StandardApplicationPool.h +4 -2
- data/ext/common/Version.h +1 -1
- data/ext/nginx/Configuration.c +1 -1
- data/ext/nginx/HttpStatusExtractor.h +1 -0
- data/ext/nginx/ScgiRequestParser.h +1 -0
- data/ext/oxt/system_calls.cpp +11 -0
- data/ext/oxt/system_calls.hpp +2 -1
- data/ext/oxt/thread.hpp +97 -1
- data/ext/phusion_passenger/native_support.c +30 -1
- data/lib/phusion_passenger/constants.rb +1 -1
- data/lib/phusion_passenger/dependencies.rb +32 -0
- data/lib/phusion_passenger/message_channel.rb +45 -3
- data/lib/phusion_passenger/platform_info.rb +1 -1
- data/lib/phusion_passenger/rack/application_spawner.rb +10 -4
- data/lib/phusion_passenger/rack/request_handler.rb +2 -5
- data/lib/phusion_passenger/railz/application_spawner.rb +59 -7
- data/lib/phusion_passenger/utils.rb +70 -16
- data/{vendor/rack-1.0.0-git/lib/rack → lib/phusion_passenger/utils}/rewindable_input.rb +34 -9
- data/test/ApplicationPoolTest.cpp +1 -1
- data/test/MessageChannelTest.cpp +9 -1
- data/test/stub/message_channel.rb +1 -1
- data/test/stub/message_channel_2.rb +1 -1
- data/test/stub/message_channel_3.rb +2 -2
- metadata +43 -155
- data/doc/Architectural overview.html +0 -1
- data/doc/rdoc/classes/ConditionVariable.html +0 -194
- data/doc/rdoc/classes/Exception.html +0 -120
- data/doc/rdoc/classes/GC.html +0 -113
- data/doc/rdoc/classes/IO.html +0 -169
- data/doc/rdoc/classes/PhusionPassenger.html +0 -238
- data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +0 -153
- data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +0 -517
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +0 -719
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerAlreadyStarted.html +0 -97
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerError.html +0 -96
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerNotStarted.html +0 -97
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/UnknownMessage.html +0 -96
- data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +0 -598
- data/doc/rdoc/classes/PhusionPassenger/AdminTools.html +0 -140
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess.html +0 -317
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess/Instance.html +0 -138
- data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +0 -154
- data/doc/rdoc/classes/PhusionPassenger/Application.html +0 -283
- data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +0 -172
- data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +0 -145
- data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +0 -181
- data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +0 -141
- data/doc/rdoc/classes/PhusionPassenger/InvalidPath.html +0 -92
- data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +0 -489
- data/doc/rdoc/classes/PhusionPassenger/NativeSupport.html +0 -350
- data/doc/rdoc/classes/PhusionPassenger/Rack.html +0 -91
- data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner.html +0 -188
- data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +0 -199
- data/doc/rdoc/classes/PhusionPassenger/Railz.html +0 -95
- data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner.html +0 -438
- data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner/Error.html +0 -98
- data/doc/rdoc/classes/PhusionPassenger/Railz/CGIFixed.html +0 -200
- data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner.html +0 -436
- data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner/Error.html +0 -98
- data/doc/rdoc/classes/PhusionPassenger/Railz/RequestHandler.html +0 -155
- data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +0 -402
- data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +0 -125
- data/doc/rdoc/classes/PhusionPassenger/Utils.html +0 -803
- data/doc/rdoc/classes/PhusionPassenger/Utils/PseudoIO.html +0 -169
- data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +0 -140
- data/doc/rdoc/classes/PhusionPassenger/WSGI.html +0 -89
- data/doc/rdoc/classes/PhusionPassenger/WSGI/ApplicationSpawner.html +0 -188
- data/doc/rdoc/classes/PlatformInfo.html +0 -866
- data/doc/rdoc/classes/RakeExtensions.html +0 -197
- data/doc/rdoc/classes/Signal.html +0 -131
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/DEVELOPERS_TXT.html +0 -255
- data/doc/rdoc/files/README.html +0 -175
- data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +0 -92
- data/doc/rdoc/files/lib/phusion_passenger/abstract_installer_rb.html +0 -129
- data/doc/rdoc/files/lib/phusion_passenger/abstract_request_handler_rb.html +0 -129
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_collection_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +0 -128
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools/control_process_rb.html +0 -130
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/application_rb.html +0 -127
- data/doc/rdoc/files/lib/phusion_passenger/console_text_template_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/dependencies_rb.html +0 -134
- data/doc/rdoc/files/lib/phusion_passenger/events_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/exceptions_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/html_template_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +0 -120
- data/doc/rdoc/files/lib/phusion_passenger/packaging_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +0 -127
- data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +0 -133
- data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +0 -125
- data/doc/rdoc/files/lib/phusion_passenger/railz/application_spawner_rb.html +0 -140
- data/doc/rdoc/files/lib/phusion_passenger/railz/cgi_fixed_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/railz/framework_spawner_rb.html +0 -145
- data/doc/rdoc/files/lib/phusion_passenger/railz/request_handler_rb.html +0 -125
- data/doc/rdoc/files/lib/phusion_passenger/simple_benchmarking_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +0 -159
- data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +0 -174
- data/doc/rdoc/files/lib/phusion_passenger/wsgi/application_spawner_rb.html +0 -129
- data/doc/rdoc/files/misc/rake/extensions_rb.html +0 -130
- data/doc/rdoc/fr_class_index.html +0 -91
- data/doc/rdoc/fr_file_index.html +0 -76
- data/doc/rdoc/fr_method_index.html +0 -205
- data/doc/rdoc/index.html +0 -26
- data/doc/rdoc/rdoc-style.css +0 -187
- data/vendor/README +0 -13
- data/vendor/README_FOR_PACKAGERS +0 -1
- data/vendor/rack-1.0.0-git/COPYING +0 -18
- data/vendor/rack-1.0.0-git/KNOWN-ISSUES +0 -18
- data/vendor/rack-1.0.0-git/README +0 -353
- data/vendor/rack-1.0.0-git/Rakefile +0 -164
- data/vendor/rack-1.0.0-git/lib/rack.rb +0 -90
- data/vendor/rack-1.0.0-git/lib/rack/adapter/camping.rb +0 -22
- data/vendor/rack-1.0.0-git/lib/rack/auth/abstract/handler.rb +0 -37
- data/vendor/rack-1.0.0-git/lib/rack/auth/abstract/request.rb +0 -37
- data/vendor/rack-1.0.0-git/lib/rack/auth/basic.rb +0 -58
- data/vendor/rack-1.0.0-git/lib/rack/auth/digest/md5.rb +0 -124
- data/vendor/rack-1.0.0-git/lib/rack/auth/digest/nonce.rb +0 -51
- data/vendor/rack-1.0.0-git/lib/rack/auth/digest/params.rb +0 -55
- data/vendor/rack-1.0.0-git/lib/rack/auth/digest/request.rb +0 -40
- data/vendor/rack-1.0.0-git/lib/rack/auth/openid.rb +0 -487
- data/vendor/rack-1.0.0-git/lib/rack/builder.rb +0 -63
- data/vendor/rack-1.0.0-git/lib/rack/cascade.rb +0 -41
- data/vendor/rack-1.0.0-git/lib/rack/chunked.rb +0 -49
- data/vendor/rack-1.0.0-git/lib/rack/commonlogger.rb +0 -52
- data/vendor/rack-1.0.0-git/lib/rack/conditionalget.rb +0 -47
- data/vendor/rack-1.0.0-git/lib/rack/content_length.rb +0 -29
- data/vendor/rack-1.0.0-git/lib/rack/content_type.rb +0 -23
- data/vendor/rack-1.0.0-git/lib/rack/deflater.rb +0 -96
- data/vendor/rack-1.0.0-git/lib/rack/directory.rb +0 -153
- data/vendor/rack-1.0.0-git/lib/rack/file.rb +0 -88
- data/vendor/rack-1.0.0-git/lib/rack/handler.rb +0 -69
- data/vendor/rack-1.0.0-git/lib/rack/handler/cgi.rb +0 -61
- data/vendor/rack-1.0.0-git/lib/rack/handler/evented_mongrel.rb +0 -8
- data/vendor/rack-1.0.0-git/lib/rack/handler/fastcgi.rb +0 -88
- data/vendor/rack-1.0.0-git/lib/rack/handler/lsws.rb +0 -55
- data/vendor/rack-1.0.0-git/lib/rack/handler/mongrel.rb +0 -84
- data/vendor/rack-1.0.0-git/lib/rack/handler/scgi.rb +0 -59
- data/vendor/rack-1.0.0-git/lib/rack/handler/swiftiplied_mongrel.rb +0 -8
- data/vendor/rack-1.0.0-git/lib/rack/handler/thin.rb +0 -18
- data/vendor/rack-1.0.0-git/lib/rack/handler/webrick.rb +0 -67
- data/vendor/rack-1.0.0-git/lib/rack/head.rb +0 -19
- data/vendor/rack-1.0.0-git/lib/rack/lint.rb +0 -537
- data/vendor/rack-1.0.0-git/lib/rack/lobster.rb +0 -65
- data/vendor/rack-1.0.0-git/lib/rack/lock.rb +0 -16
- data/vendor/rack-1.0.0-git/lib/rack/methodoverride.rb +0 -27
- data/vendor/rack-1.0.0-git/lib/rack/mime.rb +0 -204
- data/vendor/rack-1.0.0-git/lib/rack/mock.rb +0 -184
- data/vendor/rack-1.0.0-git/lib/rack/recursive.rb +0 -57
- data/vendor/rack-1.0.0-git/lib/rack/reloader.rb +0 -106
- data/vendor/rack-1.0.0-git/lib/rack/request.rb +0 -248
- data/vendor/rack-1.0.0-git/lib/rack/response.rb +0 -183
- data/vendor/rack-1.0.0-git/lib/rack/session/abstract/id.rb +0 -142
- data/vendor/rack-1.0.0-git/lib/rack/session/cookie.rb +0 -91
- data/vendor/rack-1.0.0-git/lib/rack/session/memcache.rb +0 -109
- data/vendor/rack-1.0.0-git/lib/rack/session/pool.rb +0 -100
- data/vendor/rack-1.0.0-git/lib/rack/showexceptions.rb +0 -349
- data/vendor/rack-1.0.0-git/lib/rack/showstatus.rb +0 -106
- data/vendor/rack-1.0.0-git/lib/rack/static.rb +0 -38
- data/vendor/rack-1.0.0-git/lib/rack/urlmap.rb +0 -55
- data/vendor/rack-1.0.0-git/lib/rack/utils.rb +0 -522
@@ -1,719 +0,0 @@
|
|
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: PhusionPassenger::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 />PhusionPassenger::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/phusion_passenger/abstract_server_rb.html">lib/phusion_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#M000130">server</a>, with the following
|
81
|
-
properties:
|
82
|
-
</p>
|
83
|
-
<ul>
|
84
|
-
<li>The <a href="AbstractServer.html#M000130">server</a> has exactly one <a
|
85
|
-
href="AbstractServer.html#M000131">client</a>, and is connected to that <a
|
86
|
-
href="AbstractServer.html#M000131">client</a> at all times. The <a
|
87
|
-
href="AbstractServer.html#M000130">server</a> will quit when the connection
|
88
|
-
closes.
|
89
|
-
|
90
|
-
</li>
|
91
|
-
<li>The <a href="AbstractServer.html#M000130">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#M000130">server</a> through discrete messages (as
|
97
|
-
opposed to byte streams).
|
98
|
-
|
99
|
-
</li>
|
100
|
-
<li>The <a href="AbstractServer.html#M000130">server</a> can pass file
|
101
|
-
descriptors (<a href="../IO.html">IO</a> objects) back to the <a
|
102
|
-
href="AbstractServer.html#M000131">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#M000130">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#M000129">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#M000120">start</a>(). When it is no longer
|
121
|
-
needed, <a href="AbstractServer.html#M000122">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 < PhusionPassenger::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="#M000125">before_fork</a></li>
|
159
|
-
<li><a href="#M000131">client</a></li>
|
160
|
-
<li><a href="#M000128">define_message_handler</a></li>
|
161
|
-
<li><a href="#M000129">define_signal_handler</a></li>
|
162
|
-
<li><a href="#M000133">fileno_of</a></li>
|
163
|
-
<li><a href="#M000127">finalize_server</a></li>
|
164
|
-
<li><a href="#M000126">initialize_server</a></li>
|
165
|
-
<li><a href="#M000119">new</a></li>
|
166
|
-
<li><a href="#M000132">quit_main</a></li>
|
167
|
-
<li><a href="#M000130">server</a></li>
|
168
|
-
<li><a href="#M000124">server_pid</a></li>
|
169
|
-
<li><a href="#M000120">start</a></li>
|
170
|
-
<li><a href="#M000121">start_synchronously</a></li>
|
171
|
-
<li><a href="#M000123">started?</a></li>
|
172
|
-
<li><a href="#M000122">stop</a></li>
|
173
|
-
</ul>
|
174
|
-
|
175
|
-
<div class="sectiontitle">Included Modules</div>
|
176
|
-
<ul>
|
177
|
-
<li><a href="Utils.html">Utils</a></li>
|
178
|
-
</ul>
|
179
|
-
|
180
|
-
|
181
|
-
<div class="sectiontitle">Classes and Modules</div>
|
182
|
-
Class <a href="AbstractServer/ServerAlreadyStarted.html" class="link">PhusionPassenger::AbstractServer::ServerAlreadyStarted</a><br />
|
183
|
-
Class <a href="AbstractServer/ServerError.html" class="link">PhusionPassenger::AbstractServer::ServerError</a><br />
|
184
|
-
Class <a href="AbstractServer/ServerNotStarted.html" class="link">PhusionPassenger::AbstractServer::ServerNotStarted</a><br />
|
185
|
-
Class <a href="AbstractServer/UnknownMessage.html" class="link">PhusionPassenger::AbstractServer::UnknownMessage</a><br />
|
186
|
-
|
187
|
-
|
188
|
-
<div class="sectiontitle">Constants</div>
|
189
|
-
<table border='0' cellpadding='5'>
|
190
|
-
<tr valign='top'>
|
191
|
-
<td class="attr-name">SERVER_TERMINATION_SIGNAL</td>
|
192
|
-
<td>=</td>
|
193
|
-
<td class="attr-value">"SIGTERM"</td>
|
194
|
-
</tr>
|
195
|
-
</table>
|
196
|
-
|
197
|
-
<div class="sectiontitle">Attributes</div>
|
198
|
-
<table border='0' cellpadding='5'>
|
199
|
-
<tr valign='top'>
|
200
|
-
<td class='attr-rw'>
|
201
|
-
[RW]
|
202
|
-
</td>
|
203
|
-
<td class='attr-name'>last_activity_time</td>
|
204
|
-
<td class='attr-desc'>
|
205
|
-
The last time when this <a href="AbstractServer.html">AbstractServer</a>
|
206
|
-
had processed a message.
|
207
|
-
|
208
|
-
</td>
|
209
|
-
</tr>
|
210
|
-
<tr valign='top'>
|
211
|
-
<td class='attr-rw'>
|
212
|
-
[RW]
|
213
|
-
</td>
|
214
|
-
<td class='attr-name'>max_idle_time</td>
|
215
|
-
<td class='attr-desc'>
|
216
|
-
The maximum time that this <a href="AbstractServer.html">AbstractServer</a>
|
217
|
-
may be idle. Used by <a
|
218
|
-
href="AbstractServerCollection.html">AbstractServerCollection</a> to
|
219
|
-
determine when this object should be cleaned up. nil or 0 indicate that
|
220
|
-
this object should never be idle cleaned.
|
221
|
-
|
222
|
-
</td>
|
223
|
-
</tr>
|
224
|
-
<tr valign='top'>
|
225
|
-
<td class='attr-rw'>
|
226
|
-
[RW]
|
227
|
-
</td>
|
228
|
-
<td class='attr-name'>next_cleaning_time</td>
|
229
|
-
<td class='attr-desc'>
|
230
|
-
Used by <a
|
231
|
-
href="AbstractServerCollection.html">AbstractServerCollection</a> to
|
232
|
-
remember when this <a href="AbstractServer.html">AbstractServer</a> should
|
233
|
-
be idle cleaned.
|
234
|
-
|
235
|
-
</td>
|
236
|
-
</tr>
|
237
|
-
</table>
|
238
|
-
|
239
|
-
<div class="sectiontitle">Public Class methods</div>
|
240
|
-
<div class="method">
|
241
|
-
<div class="title">
|
242
|
-
<a name="M000119"></a><b>new</b>()
|
243
|
-
</div>
|
244
|
-
<div class="sourcecode">
|
245
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000119_source')" id="l_M000119_source">show source</a> ]</p>
|
246
|
-
<div id="M000119_source" class="dyn-source">
|
247
|
-
<pre>
|
248
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line 109</span>
|
249
|
-
109: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
|
250
|
-
110: <span class="ruby-ivar">@done</span> = <span class="ruby-keyword kw">false</span>
|
251
|
-
111: <span class="ruby-ivar">@message_handlers</span> = {}
|
252
|
-
112: <span class="ruby-ivar">@signal_handlers</span> = {}
|
253
|
-
113: <span class="ruby-ivar">@orig_signal_handlers</span> = {}
|
254
|
-
114: <span class="ruby-ivar">@last_activity_time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
255
|
-
115: <span class="ruby-keyword kw">end</span>
|
256
|
-
</pre>
|
257
|
-
</div>
|
258
|
-
</div>
|
259
|
-
</div>
|
260
|
-
<div class="sectiontitle">Public Instance methods</div>
|
261
|
-
<div class="method">
|
262
|
-
<div class="title">
|
263
|
-
<a name="M000124"></a><b>server_pid</b>()
|
264
|
-
</div>
|
265
|
-
<div class="description">
|
266
|
-
<p>
|
267
|
-
Return the PID of the started <a
|
268
|
-
href="AbstractServer.html#M000130">server</a>. This is only valid if <a
|
269
|
-
href="AbstractServer.html#M000120">start</a>() has been called.
|
270
|
-
</p>
|
271
|
-
</div>
|
272
|
-
<div class="sourcecode">
|
273
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000124_source')" id="l_M000124_source">show source</a> ]</p>
|
274
|
-
<div id="M000124_source" class="dyn-source">
|
275
|
-
<pre>
|
276
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line 244</span>
|
277
|
-
244: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">server_pid</span>
|
278
|
-
245: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@pid</span>
|
279
|
-
246: <span class="ruby-keyword kw">end</span>
|
280
|
-
</pre>
|
281
|
-
</div>
|
282
|
-
</div>
|
283
|
-
</div>
|
284
|
-
<div class="method">
|
285
|
-
<div class="title">
|
286
|
-
<a name="M000120"></a><b>start</b>()
|
287
|
-
</div>
|
288
|
-
<div class="description">
|
289
|
-
<p>
|
290
|
-
Start the <a href="AbstractServer.html#M000130">server</a>. This method
|
291
|
-
does not block since the <a href="AbstractServer.html#M000130">server</a>
|
292
|
-
runs asynchronously from the current process.
|
293
|
-
</p>
|
294
|
-
<p>
|
295
|
-
You may only call this method if the <a
|
296
|
-
href="AbstractServer.html#M000130">server</a> is not already started.
|
297
|
-
Otherwise, a <a
|
298
|
-
href="AbstractServer/ServerAlreadyStarted.html">ServerAlreadyStarted</a>
|
299
|
-
will be raised.
|
300
|
-
</p>
|
301
|
-
<p>
|
302
|
-
Derived classes may raise additional exceptions.
|
303
|
-
</p>
|
304
|
-
</div>
|
305
|
-
<div class="sourcecode">
|
306
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000120_source')" id="l_M000120_source">show source</a> ]</p>
|
307
|
-
<div id="M000120_source" class="dyn-source">
|
308
|
-
<pre>
|
309
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line 124</span>
|
310
|
-
124: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start</span>
|
311
|
-
125: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">started?</span>
|
312
|
-
126: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ServerAlreadyStarted</span>, <span class="ruby-value str">"Server is already started"</span>
|
313
|
-
127: <span class="ruby-keyword kw">end</span>
|
314
|
-
128:
|
315
|
-
129: <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>
|
316
|
-
130: <span class="ruby-identifier">before_fork</span>
|
317
|
-
131: <span class="ruby-ivar">@pid</span> = <span class="ruby-identifier">fork</span>
|
318
|
-
132: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@pid</span>.<span class="ruby-identifier">nil?</span>
|
319
|
-
133: <span class="ruby-keyword kw">begin</span>
|
320
|
-
134: <span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">sync</span> = <span class="ruby-keyword kw">true</span>
|
321
|
-
135: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">sync</span> = <span class="ruby-keyword kw">true</span>
|
322
|
-
136: <span class="ruby-ivar">@parent_socket</span>.<span class="ruby-identifier">close</span>
|
323
|
-
137:
|
324
|
-
138: <span class="ruby-comment cmt"># During Passenger's early days, we used to close file descriptors based</span>
|
325
|
-
139: <span class="ruby-comment cmt"># on a white list of file descriptors. That proved to be way too fragile:</span>
|
326
|
-
140: <span class="ruby-comment cmt"># too many file descriptors are being left open even though they shouldn't</span>
|
327
|
-
141: <span class="ruby-comment cmt"># be. So now we close file descriptors based on a black list.</span>
|
328
|
-
142: <span class="ruby-comment cmt">#</span>
|
329
|
-
143: <span class="ruby-comment cmt"># Note that STDIN, STDOUT and STDERR may be temporarily set to</span>
|
330
|
-
144: <span class="ruby-comment cmt"># different file descriptors than 0, 1 and 2, e.g. in unit tests.</span>
|
331
|
-
145: <span class="ruby-comment cmt"># We don't want to close these either.</span>
|
332
|
-
146: <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>,
|
333
|
-
147: <span class="ruby-identifier">fileno_of</span>(<span class="ruby-constant">STDIN</span>), <span class="ruby-identifier">fileno_of</span>(<span class="ruby-constant">STDOUT</span>), <span class="ruby-identifier">fileno_of</span>(<span class="ruby-constant">STDERR</span>)].<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">uniq</span>
|
334
|
-
148: <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>)
|
335
|
-
149: <span class="ruby-comment cmt"># In addition to closing the file descriptors, one must also close</span>
|
336
|
-
150: <span class="ruby-comment cmt"># the associated IO objects. This is to prevent IO.close from</span>
|
337
|
-
151: <span class="ruby-comment cmt"># double-closing already closed file descriptors.</span>
|
338
|
-
152: <span class="ruby-identifier">close_all_io_objects_for_fds</span>(<span class="ruby-identifier">file_descriptors_to_leave_open</span>)
|
339
|
-
153:
|
340
|
-
154: <span class="ruby-comment cmt"># At this point, RubyGems might have open file handles for which</span>
|
341
|
-
155: <span class="ruby-comment cmt"># the associated file descriptors have just been closed. This can</span>
|
342
|
-
156: <span class="ruby-comment cmt"># result in mysterious 'EBADFD' errors. So we force RubyGems to</span>
|
343
|
-
157: <span class="ruby-comment cmt"># clear all open file handles.</span>
|
344
|
-
158: <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">clear_paths</span>
|
345
|
-
159:
|
346
|
-
160: <span class="ruby-comment cmt"># Reseed pseudo-random number generator for security reasons.</span>
|
347
|
-
161: <span class="ruby-identifier">srand</span>
|
348
|
-
162:
|
349
|
-
163: <span class="ruby-identifier">start_synchronously</span>(<span class="ruby-ivar">@child_socket</span>)
|
350
|
-
164: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Interrupt</span>
|
351
|
-
165: <span class="ruby-comment cmt"># Do nothing.</span>
|
352
|
-
166: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SignalException</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">signal</span>
|
353
|
-
167: <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>
|
354
|
-
168: <span class="ruby-comment cmt"># Do nothing.</span>
|
355
|
-
169: <span class="ruby-keyword kw">else</span>
|
356
|
-
170: <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>)
|
357
|
-
171: <span class="ruby-keyword kw">end</span>
|
358
|
-
172: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
359
|
-
173: <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>)
|
360
|
-
174: <span class="ruby-keyword kw">ensure</span>
|
361
|
-
175: <span class="ruby-identifier">exit!</span>
|
362
|
-
176: <span class="ruby-keyword kw">end</span>
|
363
|
-
177: <span class="ruby-keyword kw">end</span>
|
364
|
-
178: <span class="ruby-ivar">@child_socket</span>.<span class="ruby-identifier">close</span>
|
365
|
-
179: <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>)
|
366
|
-
180: <span class="ruby-keyword kw">end</span>
|
367
|
-
</pre>
|
368
|
-
</div>
|
369
|
-
</div>
|
370
|
-
</div>
|
371
|
-
<div class="method">
|
372
|
-
<div class="title">
|
373
|
-
<a name="M000121"></a><b>start_synchronously</b>(socket)
|
374
|
-
</div>
|
375
|
-
<div class="description">
|
376
|
-
<p>
|
377
|
-
Start the <a href="AbstractServer.html#M000130">server</a>, but in the
|
378
|
-
current process instead of in a child process. This method blocks until the
|
379
|
-
<a href="AbstractServer.html#M000130">server</a>‘s main loop has
|
380
|
-
ended.
|
381
|
-
</p>
|
382
|
-
<p>
|
383
|
-
<em>socket</em> is the socket that the <a
|
384
|
-
href="AbstractServer.html#M000130">server</a> should listen on. The <a
|
385
|
-
href="AbstractServer.html#M000130">server</a> main loop will end if the
|
386
|
-
socket has been closed.
|
387
|
-
</p>
|
388
|
-
<p>
|
389
|
-
All hooks will be called, except <a
|
390
|
-
href="AbstractServer.html#M000125">before_fork</a>().
|
391
|
-
</p>
|
392
|
-
</div>
|
393
|
-
<div class="sourcecode">
|
394
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000121_source')" id="l_M000121_source">show source</a> ]</p>
|
395
|
-
<div id="M000121_source" class="dyn-source">
|
396
|
-
<pre>
|
397
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line 189</span>
|
398
|
-
189: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start_synchronously</span>(<span class="ruby-identifier">socket</span>)
|
399
|
-
190: <span class="ruby-ivar">@child_socket</span> = <span class="ruby-identifier">socket</span>
|
400
|
-
191: <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>)
|
401
|
-
192: <span class="ruby-keyword kw">begin</span>
|
402
|
-
193: <span class="ruby-identifier">reset_signal_handlers</span>
|
403
|
-
194: <span class="ruby-identifier">initialize_server</span>
|
404
|
-
195: <span class="ruby-keyword kw">begin</span>
|
405
|
-
196: <span class="ruby-identifier">main_loop</span>
|
406
|
-
197: <span class="ruby-keyword kw">ensure</span>
|
407
|
-
198: <span class="ruby-identifier">finalize_server</span>
|
408
|
-
199: <span class="ruby-keyword kw">end</span>
|
409
|
-
200: <span class="ruby-keyword kw">ensure</span>
|
410
|
-
201: <span class="ruby-identifier">revert_signal_handlers</span>
|
411
|
-
202: <span class="ruby-keyword kw">end</span>
|
412
|
-
203: <span class="ruby-keyword kw">end</span>
|
413
|
-
</pre>
|
414
|
-
</div>
|
415
|
-
</div>
|
416
|
-
</div>
|
417
|
-
<div class="method">
|
418
|
-
<div class="title">
|
419
|
-
<a name="M000123"></a><b>started?</b>()
|
420
|
-
</div>
|
421
|
-
<div class="description">
|
422
|
-
<p>
|
423
|
-
Return whether the <a href="AbstractServer.html#M000130">server</a> has
|
424
|
-
been started.
|
425
|
-
</p>
|
426
|
-
</div>
|
427
|
-
<div class="sourcecode">
|
428
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000123_source')" id="l_M000123_source">show source</a> ]</p>
|
429
|
-
<div id="M000123_source" class="dyn-source">
|
430
|
-
<pre>
|
431
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line 239</span>
|
432
|
-
239: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">started?</span>
|
433
|
-
240: <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>
|
434
|
-
241: <span class="ruby-keyword kw">end</span>
|
435
|
-
</pre>
|
436
|
-
</div>
|
437
|
-
</div>
|
438
|
-
</div>
|
439
|
-
<div class="method">
|
440
|
-
<div class="title">
|
441
|
-
<a name="M000122"></a><b>stop</b>()
|
442
|
-
</div>
|
443
|
-
<div class="description">
|
444
|
-
<p>
|
445
|
-
Stop the <a href="AbstractServer.html#M000130">server</a>. The <a
|
446
|
-
href="AbstractServer.html#M000130">server</a> will quit as soon as
|
447
|
-
possible. This method waits until the <a
|
448
|
-
href="AbstractServer.html#M000130">server</a> has been stopped.
|
449
|
-
</p>
|
450
|
-
<p>
|
451
|
-
When calling this method, the <a
|
452
|
-
href="AbstractServer.html#M000130">server</a> must already be started. If
|
453
|
-
not, a <a href="AbstractServer/ServerNotStarted.html">ServerNotStarted</a>
|
454
|
-
will be raised.
|
455
|
-
</p>
|
456
|
-
</div>
|
457
|
-
<div class="sourcecode">
|
458
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000122_source')" id="l_M000122_source">show source</a> ]</p>
|
459
|
-
<div id="M000122_source" class="dyn-source">
|
460
|
-
<pre>
|
461
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line 210</span>
|
462
|
-
210: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stop</span>
|
463
|
-
211: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">started?</span>
|
464
|
-
212: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ServerNotStarted</span>, <span class="ruby-value str">"Server is not started"</span>
|
465
|
-
213: <span class="ruby-keyword kw">end</span>
|
466
|
-
214:
|
467
|
-
215: <span class="ruby-ivar">@parent_socket</span>.<span class="ruby-identifier">close</span>
|
468
|
-
216: <span class="ruby-ivar">@parent_channel</span> = <span class="ruby-keyword kw">nil</span>
|
469
|
-
217:
|
470
|
-
218: <span class="ruby-comment cmt"># Wait at most 3 seconds for server to exit. If it doesn't do that,</span>
|
471
|
-
219: <span class="ruby-comment cmt"># we kill it. If that doesn't work either, we kill it forcefully with</span>
|
472
|
-
220: <span class="ruby-comment cmt"># SIGKILL.</span>
|
473
|
-
221: <span class="ruby-keyword kw">begin</span>
|
474
|
-
222: <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>
|
475
|
-
223: <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>
|
476
|
-
224: <span class="ruby-keyword kw">end</span>
|
477
|
-
225: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>
|
478
|
-
226: <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>
|
479
|
-
227: <span class="ruby-keyword kw">begin</span>
|
480
|
-
228: <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>
|
481
|
-
229: <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>
|
482
|
-
230: <span class="ruby-keyword kw">end</span>
|
483
|
-
231: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>
|
484
|
-
232: <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>
|
485
|
-
233: <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>
|
486
|
-
234: <span class="ruby-keyword kw">end</span>
|
487
|
-
235: <span class="ruby-keyword kw">end</span>
|
488
|
-
236: <span class="ruby-keyword kw">end</span>
|
489
|
-
</pre>
|
490
|
-
</div>
|
491
|
-
</div>
|
492
|
-
</div>
|
493
|
-
<div class="sectiontitle">Protected Instance methods</div>
|
494
|
-
<div class="method">
|
495
|
-
<div class="title">
|
496
|
-
<a name="M000125"></a><b>before_fork</b>()
|
497
|
-
</div>
|
498
|
-
<div class="description">
|
499
|
-
<p>
|
500
|
-
A hook which is called when the <a
|
501
|
-
href="AbstractServer.html#M000130">server</a> is being started, just before
|
502
|
-
forking a <a href="AbstractServer.html#M000119">new</a> process. The
|
503
|
-
default implementation does nothing, this method is supposed to be
|
504
|
-
overrided by child classes.
|
505
|
-
</p>
|
506
|
-
</div>
|
507
|
-
<div class="sourcecode">
|
508
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000125_source')" id="l_M000125_source">show source</a> ]</p>
|
509
|
-
<div id="M000125_source" class="dyn-source">
|
510
|
-
<pre>
|
511
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line 251</span>
|
512
|
-
251: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">before_fork</span>
|
513
|
-
252: <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="M000131"></a><b>client</b>()
|
521
|
-
</div>
|
522
|
-
<div class="description">
|
523
|
-
<p>
|
524
|
-
Return the communication channel with the <a
|
525
|
-
href="AbstractServer.html#M000131">client</a> (i.e. the parent process that
|
526
|
-
started the <a href="AbstractServer.html#M000130">server</a>). This is a <a
|
527
|
-
href="MessageChannel.html">MessageChannel</a> object.
|
528
|
-
</p>
|
529
|
-
</div>
|
530
|
-
<div class="sourcecode">
|
531
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000131_source')" id="l_M000131_source">show source</a> ]</p>
|
532
|
-
<div id="M000131_source" class="dyn-source">
|
533
|
-
<pre>
|
534
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line 296</span>
|
535
|
-
296: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">client</span>
|
536
|
-
297: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@child_channel</span>
|
537
|
-
298: <span class="ruby-keyword kw">end</span>
|
538
|
-
</pre>
|
539
|
-
</div>
|
540
|
-
</div>
|
541
|
-
</div>
|
542
|
-
<div class="method">
|
543
|
-
<div class="title">
|
544
|
-
<a name="M000128"></a><b>define_message_handler</b>(message_name, handler)
|
545
|
-
</div>
|
546
|
-
<div class="description">
|
547
|
-
<p>
|
548
|
-
Define a handler for a message. <em>message_name</em> is the name of the
|
549
|
-
message to handle, and <em>handler</em> is the name of a method to be
|
550
|
-
called (this may either be a String or a Symbol).
|
551
|
-
</p>
|
552
|
-
<p>
|
553
|
-
A message is just a list of strings, and so <em>handler</em> will be called
|
554
|
-
with the message as its arguments, excluding the first element. See also
|
555
|
-
the example in the class description.
|
556
|
-
</p>
|
557
|
-
</div>
|
558
|
-
<div class="sourcecode">
|
559
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000128_source')" id="l_M000128_source">show source</a> ]</p>
|
560
|
-
<div id="M000128_source" class="dyn-source">
|
561
|
-
<pre>
|
562
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line 271</span>
|
563
|
-
271: <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>)
|
564
|
-
272: <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>
|
565
|
-
273: <span class="ruby-keyword kw">end</span>
|
566
|
-
</pre>
|
567
|
-
</div>
|
568
|
-
</div>
|
569
|
-
</div>
|
570
|
-
<div class="method">
|
571
|
-
<div class="title">
|
572
|
-
<a name="M000129"></a><b>define_signal_handler</b>(signal, handler)
|
573
|
-
</div>
|
574
|
-
<div class="description">
|
575
|
-
<p>
|
576
|
-
Define a handler for a signal.
|
577
|
-
</p>
|
578
|
-
</div>
|
579
|
-
<div class="sourcecode">
|
580
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000129_source')" id="l_M000129_source">show source</a> ]</p>
|
581
|
-
<div id="M000129_source" class="dyn-source">
|
582
|
-
<pre>
|
583
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line 276</span>
|
584
|
-
276: <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>)
|
585
|
-
277: <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>
|
586
|
-
278: <span class="ruby-keyword kw">end</span>
|
587
|
-
</pre>
|
588
|
-
</div>
|
589
|
-
</div>
|
590
|
-
</div>
|
591
|
-
<div class="method">
|
592
|
-
<div class="title">
|
593
|
-
<a name="M000133"></a><b>fileno_of</b>(io)
|
594
|
-
</div>
|
595
|
-
<div class="sourcecode">
|
596
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000133_source')" id="l_M000133_source">show source</a> ]</p>
|
597
|
-
<div id="M000133_source" class="dyn-source">
|
598
|
-
<pre>
|
599
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line 305</span>
|
600
|
-
305: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fileno_of</span>(<span class="ruby-identifier">io</span>)
|
601
|
-
306: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">io</span>.<span class="ruby-identifier">fileno</span>
|
602
|
-
307: <span class="ruby-keyword kw">rescue</span>
|
603
|
-
308: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
604
|
-
309: <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="M000127"></a><b>finalize_server</b>()
|
612
|
-
</div>
|
613
|
-
<div class="description">
|
614
|
-
<p>
|
615
|
-
A hook which is called when the <a
|
616
|
-
href="AbstractServer.html#M000130">server</a> is being stopped. This is
|
617
|
-
called in the child process, after the main loop has been left. The default
|
618
|
-
implementation does nothing, this method is supposed to be overrided by
|
619
|
-
child classes.
|
620
|
-
</p>
|
621
|
-
</div>
|
622
|
-
<div class="sourcecode">
|
623
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000127_source')" id="l_M000127_source">show source</a> ]</p>
|
624
|
-
<div id="M000127_source" class="dyn-source">
|
625
|
-
<pre>
|
626
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line 263</span>
|
627
|
-
263: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">finalize_server</span>
|
628
|
-
264: <span class="ruby-keyword kw">end</span>
|
629
|
-
</pre>
|
630
|
-
</div>
|
631
|
-
</div>
|
632
|
-
</div>
|
633
|
-
<div class="method">
|
634
|
-
<div class="title">
|
635
|
-
<a name="M000126"></a><b>initialize_server</b>()
|
636
|
-
</div>
|
637
|
-
<div class="description">
|
638
|
-
<p>
|
639
|
-
A hook which is called when the <a
|
640
|
-
href="AbstractServer.html#M000130">server</a> is being started. This is
|
641
|
-
called in the child process, before the main loop is entered. The default
|
642
|
-
implementation does nothing, this method is supposed to be overrided by
|
643
|
-
child classes.
|
644
|
-
</p>
|
645
|
-
</div>
|
646
|
-
<div class="sourcecode">
|
647
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000126_source')" id="l_M000126_source">show source</a> ]</p>
|
648
|
-
<div id="M000126_source" class="dyn-source">
|
649
|
-
<pre>
|
650
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line 257</span>
|
651
|
-
257: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_server</span>
|
652
|
-
258: <span class="ruby-keyword kw">end</span>
|
653
|
-
</pre>
|
654
|
-
</div>
|
655
|
-
</div>
|
656
|
-
</div>
|
657
|
-
<div class="method">
|
658
|
-
<div class="title">
|
659
|
-
<a name="M000132"></a><b>quit_main</b>()
|
660
|
-
</div>
|
661
|
-
<div class="description">
|
662
|
-
<p>
|
663
|
-
Tell the main loop to <a href="AbstractServer.html#M000122">stop</a> as
|
664
|
-
soon as possible.
|
665
|
-
</p>
|
666
|
-
</div>
|
667
|
-
<div class="sourcecode">
|
668
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000132_source')" id="l_M000132_source">show source</a> ]</p>
|
669
|
-
<div id="M000132_source" class="dyn-source">
|
670
|
-
<pre>
|
671
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line 301</span>
|
672
|
-
301: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quit_main</span>
|
673
|
-
302: <span class="ruby-ivar">@done</span> = <span class="ruby-keyword kw">true</span>
|
674
|
-
303: <span class="ruby-keyword kw">end</span>
|
675
|
-
</pre>
|
676
|
-
</div>
|
677
|
-
</div>
|
678
|
-
</div>
|
679
|
-
<div class="method">
|
680
|
-
<div class="title">
|
681
|
-
<a name="M000130"></a><b>server</b>()
|
682
|
-
</div>
|
683
|
-
<div class="description">
|
684
|
-
<p>
|
685
|
-
Return the communication channel with the <a
|
686
|
-
href="AbstractServer.html#M000130">server</a>. This is a <a
|
687
|
-
href="MessageChannel.html">MessageChannel</a> object.
|
688
|
-
</p>
|
689
|
-
<p>
|
690
|
-
Raises <a href="AbstractServer/ServerNotStarted.html">ServerNotStarted</a>
|
691
|
-
if the <a href="AbstractServer.html#M000130">server</a> hasn‘t been
|
692
|
-
started yet.
|
693
|
-
</p>
|
694
|
-
<p>
|
695
|
-
This method may only be called in the parent process, and not in the
|
696
|
-
started <a href="AbstractServer.html#M000130">server</a> process.
|
697
|
-
</p>
|
698
|
-
</div>
|
699
|
-
<div class="sourcecode">
|
700
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000130_source')" id="l_M000130_source">show source</a> ]</p>
|
701
|
-
<div id="M000130_source" class="dyn-source">
|
702
|
-
<pre>
|
703
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line 287</span>
|
704
|
-
287: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">server</span>
|
705
|
-
288: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">started?</span>
|
706
|
-
289: <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>
|
707
|
-
290: <span class="ruby-keyword kw">end</span>
|
708
|
-
291: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@parent_channel</span>
|
709
|
-
292: <span class="ruby-keyword kw">end</span>
|
710
|
-
</pre>
|
711
|
-
</div>
|
712
|
-
</div>
|
713
|
-
</div>
|
714
|
-
</div>
|
715
|
-
|
716
|
-
</div>
|
717
|
-
|
718
|
-
</body>
|
719
|
-
</html>
|