passenger 2.2.4 → 2.2.5
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/NEWS +137 -0
- data/Rakefile +101 -19
- data/bin/passenger-install-nginx-module +10 -3
- data/bin/passenger-make-enterprisey +1 -1
- data/doc/Users guide Apache.html +227 -92
- data/doc/Users guide Apache.txt +169 -75
- data/doc/Users guide Nginx.html +1 -1
- data/doc/cxxapi/Bucket_8h-source.html +1 -1
- data/doc/cxxapi/Configuration_8h-source.html +373 -338
- data/doc/cxxapi/DirectoryMapper_8h-source.html +1 -1
- data/doc/cxxapi/Hooks_8h-source.html +1 -1
- data/doc/cxxapi/annotated.html +1 -1
- data/doc/cxxapi/classHooks-members.html +1 -1
- data/doc/cxxapi/classHooks.html +2 -2
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper-members.html +1 -1
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper.html +1 -1
- data/doc/cxxapi/classes.html +1 -1
- data/doc/cxxapi/definitions_8h-source.html +1 -1
- data/doc/cxxapi/files.html +1 -1
- data/doc/cxxapi/functions.html +1 -1
- data/doc/cxxapi/functions_func.html +1 -1
- data/doc/cxxapi/graph_legend.html +1 -1
- data/doc/cxxapi/group__Configuration.html +1 -1
- data/doc/cxxapi/group__Core.html +1 -1
- data/doc/cxxapi/group__Hooks.html +1 -1
- data/doc/cxxapi/group__Support.html +1 -1
- data/doc/cxxapi/main.html +1 -1
- data/doc/cxxapi/modules.html +1 -1
- data/doc/rdoc/classes/ConditionVariable.html +59 -59
- data/doc/rdoc/classes/Exception.html +11 -11
- data/doc/rdoc/classes/GC.html +4 -4
- data/doc/rdoc/classes/IO.html +14 -14
- data/doc/rdoc/classes/PhusionPassenger.html +1 -1
- data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +8 -8
- data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +136 -136
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +254 -254
- data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +61 -61
- data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +4 -4
- data/doc/rdoc/classes/PhusionPassenger/Application.html +14 -14
- data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +12 -12
- data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +4 -4
- data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +12 -12
- data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +5 -5
- data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +139 -139
- data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +61 -56
- data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner.html +3 -3
- data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner.html +7 -7
- data/doc/rdoc/classes/PhusionPassenger/Railz/RequestHandler.html +15 -15
- data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +119 -119
- data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +4 -4
- data/doc/rdoc/classes/PhusionPassenger/Utils.html +310 -312
- data/doc/rdoc/classes/PhusionPassenger/Utils/PseudoIO.html +169 -0
- data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +4 -4
- data/doc/rdoc/classes/PlatformInfo.html +165 -164
- data/doc/rdoc/classes/Signal.html +23 -23
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/abstract_request_handler_rb.html +26 -28
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +26 -28
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools/control_process_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +26 -28
- data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +26 -28
- data/doc/rdoc/files/lib/phusion_passenger/railz/application_spawner_rb.html +1 -2
- data/doc/rdoc/files/lib/phusion_passenger/railz/framework_spawner_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/railz/request_handler_rb.html +26 -28
- data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +26 -28
- data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +34 -36
- data/doc/rdoc/fr_class_index.html +1 -0
- data/doc/rdoc/fr_method_index.html +72 -68
- data/ext/apache2/Configuration.cpp +69 -15
- data/ext/apache2/Configuration.h +37 -2
- data/ext/apache2/Hooks.cpp +167 -59
- data/ext/common/ApplicationPoolServerExecutable.cpp +1 -1
- data/ext/common/MessageChannel.h +4 -4
- data/ext/common/StandardApplicationPool.h +1 -1
- data/ext/common/Timer.h +2 -0
- data/ext/common/Version.h +1 -1
- data/ext/nginx/Configuration.c +3 -3
- data/ext/nginx/ContentHandler.c +16 -4
- data/ext/nginx/HelperServer.cpp +1 -1
- data/ext/oxt/system_calls.cpp +6 -1
- data/ext/oxt/thread.hpp +17 -2
- data/ext/phusion_passenger/native_support.c +4 -4
- data/lib/phusion_passenger/abstract_request_handler.rb +3 -3
- data/lib/phusion_passenger/abstract_server.rb +1 -0
- data/lib/phusion_passenger/constants.rb +1 -1
- data/lib/phusion_passenger/message_channel.rb +1 -0
- data/lib/phusion_passenger/platform_info.rb +3 -2
- data/lib/phusion_passenger/rack/request_handler.rb +11 -7
- data/lib/phusion_passenger/railz/application_spawner.rb +7 -4
- data/lib/phusion_passenger/railz/request_handler.rb +1 -0
- data/lib/phusion_passenger/spawn_manager.rb +1 -0
- data/lib/phusion_passenger/utils.rb +38 -20
- data/test/integration_tests/apache2_tests.rb +162 -100
- data/test/integration_tests/mycook_spec.rb +63 -62
- data/test/integration_tests/nginx_tests.rb +12 -5
- data/test/ruby/utils_spec.rb +98 -14
- data/test/stub/apache2/httpd.conf.erb +2 -1
- data/test/stub/rails_apps/mycook/app/controllers/welcome_controller.rb +8 -0
- data/test/support/apache2_controller.rb +5 -1
- data/test/support/test_helper.rb +42 -13
- metadata +7 -137
@@ -161,11 +161,11 @@ and sends it to the request handler.
|
|
161
161
|
|
162
162
|
<div class="sectiontitle">Methods</div>
|
163
163
|
<ul>
|
164
|
-
<li><a href="#
|
165
|
-
<li><a href="#
|
166
|
-
<li><a href="#
|
167
|
-
<li><a href="#
|
168
|
-
<li><a href="#
|
164
|
+
<li><a href="#M000125">cleanup</a></li>
|
165
|
+
<li><a href="#M000127">main_loop</a></li>
|
166
|
+
<li><a href="#M000126">main_loop_running?</a></li>
|
167
|
+
<li><a href="#M000124">new</a></li>
|
168
|
+
<li><a href="#M000128">start_main_loop_thread</a></li>
|
169
169
|
</ul>
|
170
170
|
|
171
171
|
<div class="sectiontitle">Included Modules</div>
|
@@ -268,7 +268,7 @@ exceptions.
|
|
268
268
|
<td class='attr-name'>socket_name</td>
|
269
269
|
<td class='attr-desc'>
|
270
270
|
The name of the socket on which the request handler accepts <a
|
271
|
-
href="AbstractRequestHandler.html#
|
271
|
+
href="AbstractRequestHandler.html#M000124">new</a> connections. At this
|
272
272
|
moment, this value is always the filename of a Unix domain socket.
|
273
273
|
|
274
274
|
<p>
|
@@ -292,11 +292,11 @@ always ‘unix’, which indicates a Unix domain socket.
|
|
292
292
|
<div class="sectiontitle">Public Class methods</div>
|
293
293
|
<div class="method">
|
294
294
|
<div class="title">
|
295
|
-
<a name="
|
295
|
+
<a name="M000124"></a><b>new</b>(owner_pipe, options = {})
|
296
296
|
</div>
|
297
297
|
<div class="description">
|
298
298
|
<p>
|
299
|
-
Create a <a href="AbstractRequestHandler.html#
|
299
|
+
Create a <a href="AbstractRequestHandler.html#M000124">new</a>
|
300
300
|
RequestHandler with the given owner pipe. <tt>owner_pipe</tt> must be the
|
301
301
|
readable part of a pipe <a href="../IO.html">IO</a> object.
|
302
302
|
</p>
|
@@ -310,27 +310,27 @@ Additionally, the following options may be given:
|
|
310
310
|
</ul>
|
311
311
|
</div>
|
312
312
|
<div class="sourcecode">
|
313
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
314
|
-
<div id="
|
313
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000124_source')" id="l_M000124_source">show source</a> ]</p>
|
314
|
+
<div id="M000124_source" class="dyn-source">
|
315
315
|
<pre>
|
316
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_request_handler.rb, line
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
316
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_request_handler.rb, line 137</span>
|
317
|
+
137: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">owner_pipe</span>, <span class="ruby-identifier">options</span> = {})
|
318
|
+
138: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">should_use_unix_sockets?</span>
|
319
|
+
139: <span class="ruby-identifier">create_unix_socket_on_filesystem</span>
|
320
|
+
140: <span class="ruby-keyword kw">else</span>
|
321
|
+
141: <span class="ruby-identifier">create_tcp_socket</span>
|
322
|
+
142: <span class="ruby-keyword kw">end</span>
|
323
|
+
143: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">close_on_exec!</span>
|
324
|
+
144: <span class="ruby-ivar">@owner_pipe</span> = <span class="ruby-identifier">owner_pipe</span>
|
325
|
+
145: <span class="ruby-ivar">@previous_signal_handlers</span> = {}
|
326
|
+
146: <span class="ruby-ivar">@main_loop_generation</span> = <span class="ruby-value">0</span>
|
327
|
+
147: <span class="ruby-ivar">@main_loop_thread_lock</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span>
|
328
|
+
148: <span class="ruby-ivar">@main_loop_thread_cond</span> = <span class="ruby-constant">ConditionVariable</span>.<span class="ruby-identifier">new</span>
|
329
|
+
149: <span class="ruby-ivar">@memory_limit</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value str">"memory_limit"</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
|
330
|
+
150: <span class="ruby-ivar">@iterations</span> = <span class="ruby-value">0</span>
|
331
|
+
151: <span class="ruby-ivar">@processed_requests</span> = <span class="ruby-value">0</span>
|
332
|
+
152: <span class="ruby-ivar">@main_loop_running</span> = <span class="ruby-keyword kw">false</span>
|
333
|
+
153: <span class="ruby-keyword kw">end</span>
|
334
334
|
</pre>
|
335
335
|
</div>
|
336
336
|
</div>
|
@@ -338,7 +338,7 @@ Additionally, the following options may be given:
|
|
338
338
|
<div class="sectiontitle">Public Instance methods</div>
|
339
339
|
<div class="method">
|
340
340
|
<div class="title">
|
341
|
-
<a name="
|
341
|
+
<a name="M000125"></a><b>cleanup</b>()
|
342
342
|
</div>
|
343
343
|
<div class="description">
|
344
344
|
<p>
|
@@ -346,39 +346,39 @@ Clean up temporary stuff created by the request handler.
|
|
346
346
|
</p>
|
347
347
|
<p>
|
348
348
|
If the main loop was started by <a
|
349
|
-
href="AbstractRequestHandler.html#
|
349
|
+
href="AbstractRequestHandler.html#M000127">#main_loop</a>, then this method
|
350
350
|
may only be called after the main loop has exited.
|
351
351
|
</p>
|
352
352
|
<p>
|
353
353
|
If the main loop was started by <a
|
354
|
-
href="AbstractRequestHandler.html#
|
354
|
+
href="AbstractRequestHandler.html#M000128">#start_main_loop_thread</a>,
|
355
355
|
then this method may be called at any time, and it will stop the main loop
|
356
356
|
thread.
|
357
357
|
</p>
|
358
358
|
</div>
|
359
359
|
<div class="sourcecode">
|
360
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
361
|
-
<div id="
|
360
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000125_source')" id="l_M000125_source">show source</a> ]</p>
|
361
|
+
<div id="M000125_source" class="dyn-source">
|
362
362
|
<pre>
|
363
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_request_handler.rb, line
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
363
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_request_handler.rb, line 162</span>
|
364
|
+
162: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cleanup</span>
|
365
|
+
163: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@main_loop_thread</span>
|
366
|
+
164: <span class="ruby-ivar">@main_loop_thread_lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
|
367
|
+
165: <span class="ruby-ivar">@graceful_termination_pipe</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
368
|
+
166: <span class="ruby-keyword kw">end</span>
|
369
|
+
167: <span class="ruby-ivar">@main_loop_thread</span>.<span class="ruby-identifier">join</span>
|
370
|
+
168: <span class="ruby-keyword kw">end</span>
|
371
|
+
169: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
372
|
+
170: <span class="ruby-ivar">@owner_pipe</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
373
|
+
171: <span class="ruby-constant">File</span>.<span class="ruby-identifier">unlink</span>(<span class="ruby-ivar">@socket_name</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
374
|
+
172: <span class="ruby-keyword kw">end</span>
|
375
375
|
</pre>
|
376
376
|
</div>
|
377
377
|
</div>
|
378
378
|
</div>
|
379
379
|
<div class="method">
|
380
380
|
<div class="title">
|
381
|
-
<a name="
|
381
|
+
<a name="M000127"></a><b>main_loop</b>()
|
382
382
|
</div>
|
383
383
|
<div class="description">
|
384
384
|
<p>
|
@@ -386,80 +386,80 @@ Enter the request handler‘s main loop.
|
|
386
386
|
</p>
|
387
387
|
</div>
|
388
388
|
<div class="sourcecode">
|
389
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
390
|
-
<div id="
|
389
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000127_source')" id="l_M000127_source">show source</a> ]</p>
|
390
|
+
<div id="M000127_source" class="dyn-source">
|
391
391
|
<pre>
|
392
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_request_handler.rb, line
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
392
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_request_handler.rb, line 180</span>
|
393
|
+
180: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">main_loop</span>
|
394
|
+
181: <span class="ruby-identifier">reset_signal_handlers</span>
|
395
|
+
182: <span class="ruby-keyword kw">begin</span>
|
396
|
+
183: <span class="ruby-ivar">@graceful_termination_pipe</span> = <span class="ruby-constant">IO</span>.<span class="ruby-identifier">pipe</span>
|
397
|
+
184: <span class="ruby-ivar">@graceful_termination_pipe</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">close_on_exec!</span>
|
398
|
+
185: <span class="ruby-ivar">@graceful_termination_pipe</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">close_on_exec!</span>
|
399
|
+
186:
|
400
|
+
187: <span class="ruby-ivar">@main_loop_thread_lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
|
401
|
+
188: <span class="ruby-ivar">@main_loop_generation</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
402
|
+
189: <span class="ruby-ivar">@main_loop_running</span> = <span class="ruby-keyword kw">true</span>
|
403
|
+
190: <span class="ruby-ivar">@main_loop_thread_cond</span>.<span class="ruby-identifier">broadcast</span>
|
404
|
+
191: <span class="ruby-keyword kw">end</span>
|
405
|
+
192:
|
406
|
+
193: <span class="ruby-identifier">install_useful_signal_handlers</span>
|
407
|
+
194:
|
408
|
+
195: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
409
|
+
196: <span class="ruby-ivar">@iterations</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
410
|
+
197: <span class="ruby-identifier">client</span> = <span class="ruby-identifier">accept_connection</span>
|
411
|
+
198: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">client</span>.<span class="ruby-identifier">nil?</span>
|
412
|
+
199: <span class="ruby-keyword kw">break</span>
|
413
|
+
200: <span class="ruby-keyword kw">end</span>
|
414
|
+
201: <span class="ruby-keyword kw">begin</span>
|
415
|
+
202: <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">input</span> = <span class="ruby-identifier">parse_request</span>(<span class="ruby-identifier">client</span>)
|
416
|
+
203: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">headers</span>
|
417
|
+
204: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">headers</span>[<span class="ruby-constant">REQUEST_METHOD</span>] <span class="ruby-operator">==</span> <span class="ruby-constant">PING</span>
|
418
|
+
205: <span class="ruby-identifier">process_ping</span>(<span class="ruby-identifier">headers</span>, <span class="ruby-identifier">input</span>, <span class="ruby-identifier">client</span>)
|
419
|
+
206: <span class="ruby-keyword kw">else</span>
|
420
|
+
207: <span class="ruby-identifier">process_request</span>(<span class="ruby-identifier">headers</span>, <span class="ruby-identifier">input</span>, <span class="ruby-identifier">client</span>)
|
421
|
+
208: <span class="ruby-keyword kw">end</span>
|
422
|
+
209: <span class="ruby-keyword kw">end</span>
|
423
|
+
210: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">IOError</span>, <span class="ruby-constant">SocketError</span>, <span class="ruby-constant">SystemCallError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
424
|
+
211: <span class="ruby-identifier">print_exception</span>(<span class="ruby-value str">"Passenger RequestHandler"</span>, <span class="ruby-identifier">e</span>)
|
425
|
+
212: <span class="ruby-keyword kw">ensure</span>
|
426
|
+
213: <span class="ruby-comment cmt"># 'input' is the same as 'client' so we don't</span>
|
427
|
+
214: <span class="ruby-comment cmt"># need to close that.</span>
|
428
|
+
215: <span class="ruby-comment cmt"># The 'close_write' here prevents forked child</span>
|
429
|
+
216: <span class="ruby-comment cmt"># processes from unintentionally keeping the</span>
|
430
|
+
217: <span class="ruby-comment cmt"># connection open.</span>
|
431
|
+
218: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close_write</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
432
|
+
219: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
433
|
+
220: <span class="ruby-keyword kw">end</span>
|
434
|
+
221: <span class="ruby-ivar">@processed_requests</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
435
|
+
222: <span class="ruby-keyword kw">end</span>
|
436
|
+
223: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span>
|
437
|
+
224: <span class="ruby-comment cmt"># Exit main loop.</span>
|
438
|
+
225: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Interrupt</span>
|
439
|
+
226: <span class="ruby-comment cmt"># Exit main loop.</span>
|
440
|
+
227: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SignalException</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">signal</span>
|
441
|
+
228: <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">HARD_TERMINATION_SIGNAL</span> <span class="ruby-operator">&&</span>
|
442
|
+
229: <span class="ruby-identifier">signal</span>.<span class="ruby-identifier">message</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">SOFT_TERMINATION_SIGNAL</span>
|
443
|
+
230: <span class="ruby-identifier">raise</span>
|
444
|
+
231: <span class="ruby-keyword kw">end</span>
|
445
|
+
232: <span class="ruby-keyword kw">ensure</span>
|
446
|
+
233: <span class="ruby-identifier">revert_signal_handlers</span>
|
447
|
+
234: <span class="ruby-ivar">@main_loop_thread_lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
|
448
|
+
235: <span class="ruby-ivar">@graceful_termination_pipe</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
449
|
+
236: <span class="ruby-ivar">@graceful_termination_pipe</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
450
|
+
237: <span class="ruby-ivar">@main_loop_generation</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
451
|
+
238: <span class="ruby-ivar">@main_loop_running</span> = <span class="ruby-keyword kw">false</span>
|
452
|
+
239: <span class="ruby-ivar">@main_loop_thread_cond</span>.<span class="ruby-identifier">broadcast</span>
|
453
|
+
240: <span class="ruby-keyword kw">end</span>
|
454
|
+
241: <span class="ruby-keyword kw">end</span>
|
455
|
+
242: <span class="ruby-keyword kw">end</span>
|
456
456
|
</pre>
|
457
457
|
</div>
|
458
458
|
</div>
|
459
459
|
</div>
|
460
460
|
<div class="method">
|
461
461
|
<div class="title">
|
462
|
-
<a name="
|
462
|
+
<a name="M000126"></a><b>main_loop_running?</b>()
|
463
463
|
</div>
|
464
464
|
<div class="description">
|
465
465
|
<p>
|
@@ -467,44 +467,44 @@ Check whether the main loop‘s currently running.
|
|
467
467
|
</p>
|
468
468
|
</div>
|
469
469
|
<div class="sourcecode">
|
470
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
471
|
-
<div id="
|
470
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000126_source')" id="l_M000126_source">show source</a> ]</p>
|
471
|
+
<div id="M000126_source" class="dyn-source">
|
472
472
|
<pre>
|
473
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_request_handler.rb, line
|
474
|
-
|
475
|
-
|
476
|
-
|
473
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_request_handler.rb, line 175</span>
|
474
|
+
175: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">main_loop_running?</span>
|
475
|
+
176: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@main_loop_running</span>
|
476
|
+
177: <span class="ruby-keyword kw">end</span>
|
477
477
|
</pre>
|
478
478
|
</div>
|
479
479
|
</div>
|
480
480
|
</div>
|
481
481
|
<div class="method">
|
482
482
|
<div class="title">
|
483
|
-
<a name="
|
483
|
+
<a name="M000128"></a><b>start_main_loop_thread</b>()
|
484
484
|
</div>
|
485
485
|
<div class="description">
|
486
486
|
<p>
|
487
487
|
Start the main loop in a <a
|
488
|
-
href="AbstractRequestHandler.html#
|
489
|
-
be stopped by <a href="AbstractRequestHandler.html#
|
488
|
+
href="AbstractRequestHandler.html#M000124">new</a> thread. This thread will
|
489
|
+
be stopped by <a href="AbstractRequestHandler.html#M000125">#cleanup</a>.
|
490
490
|
</p>
|
491
491
|
</div>
|
492
492
|
<div class="sourcecode">
|
493
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
494
|
-
<div id="
|
493
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000128_source')" id="l_M000128_source">show source</a> ]</p>
|
494
|
+
<div id="M000128_source" class="dyn-source">
|
495
495
|
<pre>
|
496
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_request_handler.rb, line
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
496
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_request_handler.rb, line 245</span>
|
497
|
+
245: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start_main_loop_thread</span>
|
498
|
+
246: <span class="ruby-identifier">current_generation</span> = <span class="ruby-ivar">@main_loop_generation</span>
|
499
|
+
247: <span class="ruby-ivar">@main_loop_thread</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span>
|
500
|
+
248: <span class="ruby-identifier">main_loop</span>
|
501
|
+
249: <span class="ruby-keyword kw">end</span>
|
502
|
+
250: <span class="ruby-ivar">@main_loop_thread_lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
|
503
|
+
251: <span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@main_loop_generation</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">current_generation</span>
|
504
|
+
252: <span class="ruby-ivar">@main_loop_thread_cond</span>.<span class="ruby-identifier">wait</span>(<span class="ruby-ivar">@main_loop_thread_lock</span>)
|
505
|
+
253: <span class="ruby-keyword kw">end</span>
|
506
|
+
254: <span class="ruby-keyword kw">end</span>
|
507
|
+
255: <span class="ruby-keyword kw">end</span>
|
508
508
|
</pre>
|
509
509
|
</div>
|
510
510
|
</div>
|
@@ -77,29 +77,29 @@ Object
|
|
77
77
|
|
78
78
|
<div class="description"><p>
|
79
79
|
An abstract base class for a <a
|
80
|
-
href="AbstractServer.html#
|
80
|
+
href="AbstractServer.html#M000144">server</a>, with the following
|
81
81
|
properties:
|
82
82
|
</p>
|
83
83
|
<ul>
|
84
|
-
<li>The <a href="AbstractServer.html#
|
85
|
-
href="AbstractServer.html#
|
86
|
-
href="AbstractServer.html#
|
87
|
-
href="AbstractServer.html#
|
84
|
+
<li>The <a href="AbstractServer.html#M000144">server</a> has exactly one <a
|
85
|
+
href="AbstractServer.html#M000145">client</a>, and is connected to that <a
|
86
|
+
href="AbstractServer.html#M000145">client</a> at all times. The <a
|
87
|
+
href="AbstractServer.html#M000144">server</a> will quit when the connection
|
88
88
|
closes.
|
89
89
|
|
90
90
|
</li>
|
91
|
-
<li>The <a href="AbstractServer.html#
|
91
|
+
<li>The <a href="AbstractServer.html#M000144">server</a>‘s main loop may
|
92
92
|
be run in a child process (and so is asynchronous from the main process).
|
93
93
|
|
94
94
|
</li>
|
95
95
|
<li>One can communicate with the <a
|
96
|
-
href="AbstractServer.html#
|
96
|
+
href="AbstractServer.html#M000144">server</a> through discrete messages (as
|
97
97
|
opposed to byte streams).
|
98
98
|
|
99
99
|
</li>
|
100
|
-
<li>The <a href="AbstractServer.html#
|
100
|
+
<li>The <a href="AbstractServer.html#M000144">server</a> can pass file
|
101
101
|
descriptors (<a href="../IO.html">IO</a> objects) back to the <a
|
102
|
-
href="AbstractServer.html#
|
102
|
+
href="AbstractServer.html#M000145">client</a>.
|
103
103
|
|
104
104
|
</li>
|
105
105
|
</ul>
|
@@ -108,17 +108,17 @@ A message is just an ordered list of strings. The first element in the
|
|
108
108
|
message is the _message name_.
|
109
109
|
</p>
|
110
110
|
<p>
|
111
|
-
The <a href="AbstractServer.html#
|
111
|
+
The <a href="AbstractServer.html#M000144">server</a> will also reset all
|
112
112
|
signal handlers (in the child process). That is, it will respond to all
|
113
113
|
signals in the default manner. The only exception is SIGHUP, which is
|
114
114
|
ignored. One may define additional signal handlers using <a
|
115
|
-
href="AbstractServer.html#
|
115
|
+
href="AbstractServer.html#M000143">define_signal_handler</a>().
|
116
116
|
</p>
|
117
117
|
<p>
|
118
118
|
Before an <a href="AbstractServer.html">AbstractServer</a> can be used, it
|
119
119
|
must first be started by calling <a
|
120
|
-
href="AbstractServer.html#
|
121
|
-
needed, <a href="AbstractServer.html#
|
120
|
+
href="AbstractServer.html#M000134">start</a>(). When it is no longer
|
121
|
+
needed, <a href="AbstractServer.html#M000136">stop</a>() should be called.
|
122
122
|
</p>
|
123
123
|
<p>
|
124
124
|
Here‘s an example on using <a
|
@@ -155,21 +155,21 @@ href="AbstractServer.html">AbstractServer</a>:
|
|
155
155
|
|
156
156
|
<div class="sectiontitle">Methods</div>
|
157
157
|
<ul>
|
158
|
-
<li><a href="#
|
159
|
-
<li><a href="#
|
160
|
-
<li><a href="#
|
161
|
-
<li><a href="#
|
162
|
-
<li><a href="#
|
163
|
-
<li><a href="#
|
164
|
-
<li><a href="#
|
165
|
-
<li><a href="#
|
166
|
-
<li><a href="#
|
167
|
-
<li><a href="#
|
168
|
-
<li><a href="#
|
169
|
-
<li><a href="#
|
170
|
-
<li><a href="#
|
171
|
-
<li><a href="#
|
172
|
-
<li><a href="#
|
158
|
+
<li><a href="#M000139">before_fork</a></li>
|
159
|
+
<li><a href="#M000145">client</a></li>
|
160
|
+
<li><a href="#M000142">define_message_handler</a></li>
|
161
|
+
<li><a href="#M000143">define_signal_handler</a></li>
|
162
|
+
<li><a href="#M000147">fileno_of</a></li>
|
163
|
+
<li><a href="#M000141">finalize_server</a></li>
|
164
|
+
<li><a href="#M000140">initialize_server</a></li>
|
165
|
+
<li><a href="#M000133">new</a></li>
|
166
|
+
<li><a href="#M000146">quit_main</a></li>
|
167
|
+
<li><a href="#M000144">server</a></li>
|
168
|
+
<li><a href="#M000138">server_pid</a></li>
|
169
|
+
<li><a href="#M000134">start</a></li>
|
170
|
+
<li><a href="#M000135">start_synchronously</a></li>
|
171
|
+
<li><a href="#M000137">started?</a></li>
|
172
|
+
<li><a href="#M000136">stop</a></li>
|
173
173
|
</ul>
|
174
174
|
|
175
175
|
<div class="sectiontitle">Included Modules</div>
|
@@ -239,20 +239,20 @@ be idle cleaned.
|
|
239
239
|
<div class="sectiontitle">Public Class methods</div>
|
240
240
|
<div class="method">
|
241
241
|
<div class="title">
|
242
|
-
<a name="
|
242
|
+
<a name="M000133"></a><b>new</b>()
|
243
243
|
</div>
|
244
244
|
<div class="sourcecode">
|
245
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
246
|
-
<div id="
|
245
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000133_source')" id="l_M000133_source">show source</a> ]</p>
|
246
|
+
<div id="M000133_source" class="dyn-source">
|
247
247
|
<pre>
|
248
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
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
256
|
</pre>
|
257
257
|
</div>
|
258
258
|
</div>
|
@@ -260,40 +260,40 @@ be idle cleaned.
|
|
260
260
|
<div class="sectiontitle">Public Instance methods</div>
|
261
261
|
<div class="method">
|
262
262
|
<div class="title">
|
263
|
-
<a name="
|
263
|
+
<a name="M000138"></a><b>server_pid</b>()
|
264
264
|
</div>
|
265
265
|
<div class="description">
|
266
266
|
<p>
|
267
267
|
Return the PID of the started <a
|
268
|
-
href="AbstractServer.html#
|
269
|
-
href="AbstractServer.html#
|
268
|
+
href="AbstractServer.html#M000144">server</a>. This is only valid if <a
|
269
|
+
href="AbstractServer.html#M000134">start</a>() has been called.
|
270
270
|
</p>
|
271
271
|
</div>
|
272
272
|
<div class="sourcecode">
|
273
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
274
|
-
<div id="
|
273
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000138_source')" id="l_M000138_source">show source</a> ]</p>
|
274
|
+
<div id="M000138_source" class="dyn-source">
|
275
275
|
<pre>
|
276
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line
|
277
|
-
|
278
|
-
|
279
|
-
|
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
280
|
</pre>
|
281
281
|
</div>
|
282
282
|
</div>
|
283
283
|
</div>
|
284
284
|
<div class="method">
|
285
285
|
<div class="title">
|
286
|
-
<a name="
|
286
|
+
<a name="M000134"></a><b>start</b>()
|
287
287
|
</div>
|
288
288
|
<div class="description">
|
289
289
|
<p>
|
290
|
-
Start the <a href="AbstractServer.html#
|
291
|
-
does not block since the <a href="AbstractServer.html#
|
290
|
+
Start the <a href="AbstractServer.html#M000144">server</a>. This method
|
291
|
+
does not block since the <a href="AbstractServer.html#M000144">server</a>
|
292
292
|
runs asynchronously from the current process.
|
293
293
|
</p>
|
294
294
|
<p>
|
295
295
|
You may only call this method if the <a
|
296
|
-
href="AbstractServer.html#
|
296
|
+
href="AbstractServer.html#M000144">server</a> is not already started.
|
297
297
|
Otherwise, a <a
|
298
298
|
href="AbstractServer/ServerAlreadyStarted.html">ServerAlreadyStarted</a>
|
299
299
|
will be raised.
|
@@ -303,189 +303,189 @@ Derived classes may raise additional exceptions.
|
|
303
303
|
</p>
|
304
304
|
</div>
|
305
305
|
<div class="sourcecode">
|
306
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
307
|
-
<div id="
|
306
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000134_source')" id="l_M000134_source">show source</a> ]</p>
|
307
|
+
<div id="M000134_source" class="dyn-source">
|
308
308
|
<pre>
|
309
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
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
367
|
</pre>
|
368
368
|
</div>
|
369
369
|
</div>
|
370
370
|
</div>
|
371
371
|
<div class="method">
|
372
372
|
<div class="title">
|
373
|
-
<a name="
|
373
|
+
<a name="M000135"></a><b>start_synchronously</b>(socket)
|
374
374
|
</div>
|
375
375
|
<div class="description">
|
376
376
|
<p>
|
377
|
-
Start the <a href="AbstractServer.html#
|
377
|
+
Start the <a href="AbstractServer.html#M000144">server</a>, but in the
|
378
378
|
current process instead of in a child process. This method blocks until the
|
379
|
-
<a href="AbstractServer.html#
|
379
|
+
<a href="AbstractServer.html#M000144">server</a>‘s main loop has
|
380
380
|
ended.
|
381
381
|
</p>
|
382
382
|
<p>
|
383
383
|
<em>socket</em> is the socket that the <a
|
384
|
-
href="AbstractServer.html#
|
385
|
-
href="AbstractServer.html#
|
384
|
+
href="AbstractServer.html#M000144">server</a> should listen on. The <a
|
385
|
+
href="AbstractServer.html#M000144">server</a> main loop will end if the
|
386
386
|
socket has been closed.
|
387
387
|
</p>
|
388
388
|
<p>
|
389
389
|
All hooks will be called, except <a
|
390
|
-
href="AbstractServer.html#
|
390
|
+
href="AbstractServer.html#M000139">before_fork</a>().
|
391
391
|
</p>
|
392
392
|
</div>
|
393
393
|
<div class="sourcecode">
|
394
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
395
|
-
<div id="
|
394
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000135_source')" id="l_M000135_source">show source</a> ]</p>
|
395
|
+
<div id="M000135_source" class="dyn-source">
|
396
396
|
<pre>
|
397
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
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
413
|
</pre>
|
414
414
|
</div>
|
415
415
|
</div>
|
416
416
|
</div>
|
417
417
|
<div class="method">
|
418
418
|
<div class="title">
|
419
|
-
<a name="
|
419
|
+
<a name="M000137"></a><b>started?</b>()
|
420
420
|
</div>
|
421
421
|
<div class="description">
|
422
422
|
<p>
|
423
|
-
Return whether the <a href="AbstractServer.html#
|
423
|
+
Return whether the <a href="AbstractServer.html#M000144">server</a> has
|
424
424
|
been started.
|
425
425
|
</p>
|
426
426
|
</div>
|
427
427
|
<div class="sourcecode">
|
428
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
429
|
-
<div id="
|
428
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000137_source')" id="l_M000137_source">show source</a> ]</p>
|
429
|
+
<div id="M000137_source" class="dyn-source">
|
430
430
|
<pre>
|
431
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line
|
432
|
-
|
433
|
-
|
434
|
-
|
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
435
|
</pre>
|
436
436
|
</div>
|
437
437
|
</div>
|
438
438
|
</div>
|
439
439
|
<div class="method">
|
440
440
|
<div class="title">
|
441
|
-
<a name="
|
441
|
+
<a name="M000136"></a><b>stop</b>()
|
442
442
|
</div>
|
443
443
|
<div class="description">
|
444
444
|
<p>
|
445
|
-
Stop the <a href="AbstractServer.html#
|
446
|
-
href="AbstractServer.html#
|
445
|
+
Stop the <a href="AbstractServer.html#M000144">server</a>. The <a
|
446
|
+
href="AbstractServer.html#M000144">server</a> will quit as soon as
|
447
447
|
possible. This method waits until the <a
|
448
|
-
href="AbstractServer.html#
|
448
|
+
href="AbstractServer.html#M000144">server</a> has been stopped.
|
449
449
|
</p>
|
450
450
|
<p>
|
451
451
|
When calling this method, the <a
|
452
|
-
href="AbstractServer.html#
|
452
|
+
href="AbstractServer.html#M000144">server</a> must already be started. If
|
453
453
|
not, a <a href="AbstractServer/ServerNotStarted.html">ServerNotStarted</a>
|
454
454
|
will be raised.
|
455
455
|
</p>
|
456
456
|
</div>
|
457
457
|
<div class="sourcecode">
|
458
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
459
|
-
<div id="
|
458
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000136_source')" id="l_M000136_source">show source</a> ]</p>
|
459
|
+
<div id="M000136_source" class="dyn-source">
|
460
460
|
<pre>
|
461
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
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
489
|
</pre>
|
490
490
|
</div>
|
491
491
|
</div>
|
@@ -493,55 +493,55 @@ will be raised.
|
|
493
493
|
<div class="sectiontitle">Protected Instance methods</div>
|
494
494
|
<div class="method">
|
495
495
|
<div class="title">
|
496
|
-
<a name="
|
496
|
+
<a name="M000139"></a><b>before_fork</b>()
|
497
497
|
</div>
|
498
498
|
<div class="description">
|
499
499
|
<p>
|
500
500
|
A hook which is called when the <a
|
501
|
-
href="AbstractServer.html#
|
502
|
-
forking a <a href="AbstractServer.html#
|
501
|
+
href="AbstractServer.html#M000144">server</a> is being started, just before
|
502
|
+
forking a <a href="AbstractServer.html#M000133">new</a> process. The
|
503
503
|
default implementation does nothing, this method is supposed to be
|
504
504
|
overrided by child classes.
|
505
505
|
</p>
|
506
506
|
</div>
|
507
507
|
<div class="sourcecode">
|
508
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
509
|
-
<div id="
|
508
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000139_source')" id="l_M000139_source">show source</a> ]</p>
|
509
|
+
<div id="M000139_source" class="dyn-source">
|
510
510
|
<pre>
|
511
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line
|
512
|
-
|
513
|
-
|
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
514
|
</pre>
|
515
515
|
</div>
|
516
516
|
</div>
|
517
517
|
</div>
|
518
518
|
<div class="method">
|
519
519
|
<div class="title">
|
520
|
-
<a name="
|
520
|
+
<a name="M000145"></a><b>client</b>()
|
521
521
|
</div>
|
522
522
|
<div class="description">
|
523
523
|
<p>
|
524
524
|
Return the communication channel with the <a
|
525
|
-
href="AbstractServer.html#
|
526
|
-
started the <a href="AbstractServer.html#
|
525
|
+
href="AbstractServer.html#M000145">client</a> (i.e. the parent process that
|
526
|
+
started the <a href="AbstractServer.html#M000144">server</a>). This is a <a
|
527
527
|
href="MessageChannel.html">MessageChannel</a> object.
|
528
528
|
</p>
|
529
529
|
</div>
|
530
530
|
<div class="sourcecode">
|
531
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
532
|
-
<div id="
|
531
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000145_source')" id="l_M000145_source">show source</a> ]</p>
|
532
|
+
<div id="M000145_source" class="dyn-source">
|
533
533
|
<pre>
|
534
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line
|
535
|
-
|
536
|
-
|
537
|
-
|
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
538
|
</pre>
|
539
539
|
</div>
|
540
540
|
</div>
|
541
541
|
</div>
|
542
542
|
<div class="method">
|
543
543
|
<div class="title">
|
544
|
-
<a name="
|
544
|
+
<a name="M000142"></a><b>define_message_handler</b>(message_name, handler)
|
545
545
|
</div>
|
546
546
|
<div class="description">
|
547
547
|
<p>
|
@@ -556,20 +556,20 @@ the example in the class description.
|
|
556
556
|
</p>
|
557
557
|
</div>
|
558
558
|
<div class="sourcecode">
|
559
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
560
|
-
<div id="
|
559
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000142_source')" id="l_M000142_source">show source</a> ]</p>
|
560
|
+
<div id="M000142_source" class="dyn-source">
|
561
561
|
<pre>
|
562
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line
|
563
|
-
|
564
|
-
|
565
|
-
|
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
566
|
</pre>
|
567
567
|
</div>
|
568
568
|
</div>
|
569
569
|
</div>
|
570
570
|
<div class="method">
|
571
571
|
<div class="title">
|
572
|
-
<a name="
|
572
|
+
<a name="M000143"></a><b>define_signal_handler</b>(signal, handler)
|
573
573
|
</div>
|
574
574
|
<div class="description">
|
575
575
|
<p>
|
@@ -577,136 +577,136 @@ Define a handler for a signal.
|
|
577
577
|
</p>
|
578
578
|
</div>
|
579
579
|
<div class="sourcecode">
|
580
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
581
|
-
<div id="
|
580
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000143_source')" id="l_M000143_source">show source</a> ]</p>
|
581
|
+
<div id="M000143_source" class="dyn-source">
|
582
582
|
<pre>
|
583
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line
|
584
|
-
|
585
|
-
|
586
|
-
|
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
587
|
</pre>
|
588
588
|
</div>
|
589
589
|
</div>
|
590
590
|
</div>
|
591
591
|
<div class="method">
|
592
592
|
<div class="title">
|
593
|
-
<a name="
|
593
|
+
<a name="M000147"></a><b>fileno_of</b>(io)
|
594
594
|
</div>
|
595
595
|
<div class="sourcecode">
|
596
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
597
|
-
<div id="
|
596
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000147_source')" id="l_M000147_source">show source</a> ]</p>
|
597
|
+
<div id="M000147_source" class="dyn-source">
|
598
598
|
<pre>
|
599
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
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
605
|
</pre>
|
606
606
|
</div>
|
607
607
|
</div>
|
608
608
|
</div>
|
609
609
|
<div class="method">
|
610
610
|
<div class="title">
|
611
|
-
<a name="
|
611
|
+
<a name="M000141"></a><b>finalize_server</b>()
|
612
612
|
</div>
|
613
613
|
<div class="description">
|
614
614
|
<p>
|
615
615
|
A hook which is called when the <a
|
616
|
-
href="AbstractServer.html#
|
616
|
+
href="AbstractServer.html#M000144">server</a> is being stopped. This is
|
617
617
|
called in the child process, after the main loop has been left. The default
|
618
618
|
implementation does nothing, this method is supposed to be overrided by
|
619
619
|
child classes.
|
620
620
|
</p>
|
621
621
|
</div>
|
622
622
|
<div class="sourcecode">
|
623
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
624
|
-
<div id="
|
623
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000141_source')" id="l_M000141_source">show source</a> ]</p>
|
624
|
+
<div id="M000141_source" class="dyn-source">
|
625
625
|
<pre>
|
626
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line
|
627
|
-
|
628
|
-
|
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
629
|
</pre>
|
630
630
|
</div>
|
631
631
|
</div>
|
632
632
|
</div>
|
633
633
|
<div class="method">
|
634
634
|
<div class="title">
|
635
|
-
<a name="
|
635
|
+
<a name="M000140"></a><b>initialize_server</b>()
|
636
636
|
</div>
|
637
637
|
<div class="description">
|
638
638
|
<p>
|
639
639
|
A hook which is called when the <a
|
640
|
-
href="AbstractServer.html#
|
640
|
+
href="AbstractServer.html#M000144">server</a> is being started. This is
|
641
641
|
called in the child process, before the main loop is entered. The default
|
642
642
|
implementation does nothing, this method is supposed to be overrided by
|
643
643
|
child classes.
|
644
644
|
</p>
|
645
645
|
</div>
|
646
646
|
<div class="sourcecode">
|
647
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
648
|
-
<div id="
|
647
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000140_source')" id="l_M000140_source">show source</a> ]</p>
|
648
|
+
<div id="M000140_source" class="dyn-source">
|
649
649
|
<pre>
|
650
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line
|
651
|
-
|
652
|
-
|
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
653
|
</pre>
|
654
654
|
</div>
|
655
655
|
</div>
|
656
656
|
</div>
|
657
657
|
<div class="method">
|
658
658
|
<div class="title">
|
659
|
-
<a name="
|
659
|
+
<a name="M000146"></a><b>quit_main</b>()
|
660
660
|
</div>
|
661
661
|
<div class="description">
|
662
662
|
<p>
|
663
|
-
Tell the main loop to <a href="AbstractServer.html#
|
663
|
+
Tell the main loop to <a href="AbstractServer.html#M000136">stop</a> as
|
664
664
|
soon as possible.
|
665
665
|
</p>
|
666
666
|
</div>
|
667
667
|
<div class="sourcecode">
|
668
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
669
|
-
<div id="
|
668
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000146_source')" id="l_M000146_source">show source</a> ]</p>
|
669
|
+
<div id="M000146_source" class="dyn-source">
|
670
670
|
<pre>
|
671
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line
|
672
|
-
|
673
|
-
|
674
|
-
|
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
675
|
</pre>
|
676
676
|
</div>
|
677
677
|
</div>
|
678
678
|
</div>
|
679
679
|
<div class="method">
|
680
680
|
<div class="title">
|
681
|
-
<a name="
|
681
|
+
<a name="M000144"></a><b>server</b>()
|
682
682
|
</div>
|
683
683
|
<div class="description">
|
684
684
|
<p>
|
685
685
|
Return the communication channel with the <a
|
686
|
-
href="AbstractServer.html#
|
686
|
+
href="AbstractServer.html#M000144">server</a>. This is a <a
|
687
687
|
href="MessageChannel.html">MessageChannel</a> object.
|
688
688
|
</p>
|
689
689
|
<p>
|
690
690
|
Raises <a href="AbstractServer/ServerNotStarted.html">ServerNotStarted</a>
|
691
|
-
if the <a href="AbstractServer.html#
|
691
|
+
if the <a href="AbstractServer.html#M000144">server</a> hasn‘t been
|
692
692
|
started yet.
|
693
693
|
</p>
|
694
694
|
<p>
|
695
695
|
This method may only be called in the parent process, and not in the
|
696
|
-
started <a href="AbstractServer.html#
|
696
|
+
started <a href="AbstractServer.html#M000144">server</a> process.
|
697
697
|
</p>
|
698
698
|
</div>
|
699
699
|
<div class="sourcecode">
|
700
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
701
|
-
<div id="
|
700
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000144_source')" id="l_M000144_source">show source</a> ]</p>
|
701
|
+
<div id="M000144_source" class="dyn-source">
|
702
702
|
<pre>
|
703
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_server.rb, line
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
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
710
|
</pre>
|
711
711
|
</div>
|
712
712
|
</div>
|