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