public
Description: A very fast & simple Ruby web server
Homepage: http://code.macournoyer.com/thin/
Clone URL: git://github.com/macournoyer/thin.git
Search Repo:
INT signal now force stop and QUIT signal graceful stop.
macournoyer (author)
Tue Feb 19 21:38:54 -0800 2008
commit  434ca28bfbadff572b66d57c5d699513036edc5e
tree    046940e1aa0643eebd25e5713d052dd63fe4b42b
parent  0e1eaf123a113403f3517f0bf7d35928dd40d48e
...
1
 
2
3
4
...
1
2
3
4
5
0
@@ -1,4 +1,5 @@
0
 == 0.7.0 Spherical Cow release
0
+ * INT signal now force stop and QUIT signal graceful stop.
0
  * Warn when descriptors table size can't be set as high as expected.
0
  * Eval Rackup config file using top level bindings.
0
  * Remove daemons gem dependency on Windows plateform, fixes #45.
...
13
14
15
16
 
 
 
 
 
17
18
19
...
13
14
15
 
16
17
18
19
20
21
22
23
0
@@ -13,7 +13,11 @@ module Thin
0
     # Connector to the server
0
     attr_accessor :connector
0
     
0
- attr_accessor :request, :response
0
+ # Current request served by the connection
0
+ attr_accessor :request
0
+
0
+ # Next response sent through connection
0
+ attr_accessor :response
0
     
0
     # Get the connection ready to process a request.
0
     def post_init
...
89
90
91
92
 
93
94
95
96
 
97
98
99
...
89
90
91
 
92
93
94
95
 
96
97
98
99
0
@@ -89,11 +89,11 @@ module Thin
0
     end
0
     
0
     module ClassMethods
0
- # Send a INT signal the process which PID is stored in +pid_file+.
0
+ # Send a QUIT signal the process which PID is stored in +pid_file+.
0
       # If the process is still running after +timeout+, KILL signal is
0
       # sent.
0
       def kill(pid_file, timeout=60)
0
- if pid = send_signal('INT', pid_file)
0
+ if pid = send_signal('QUIT', pid_file)
0
           begin
0
             Timeout.timeout(timeout) do
0
               sleep 0.1 while Process.running?(pid)
...
124
125
126
127
128
 
129
130
131
...
196
197
198
199
 
 
 
 
 
 
 
200
201
202
...
124
125
126
 
 
127
128
129
130
...
195
196
197
 
198
199
200
201
202
203
204
205
206
207
0
@@ -124,8 +124,7 @@ module Thin
0
     def start
0
       raise ArgumentError, 'app required' unless @app
0
       
0
- trap('INT') { stop }
0
- trap('TERM') { stop! }
0
+ setup_signals
0
             
0
       # See http://rubyeventmachine.com/pub/rdoc/files/EPOLL.html
0
       EventMachine.epoll
0
@@ -196,6 +195,12 @@ module Thin
0
           log ">> Waiting for #{@connector.size} connection(s) to finish, can take up to #{timeout} sec, CTRL+C to stop now"
0
           false
0
         end
0
- end
0
+ end
0
+
0
+ def setup_signals
0
+ trap('QUIT') { stop }
0
+ trap('INT') { stop! }
0
+ trap('TERM') { stop! }
0
+ end
0
   end
0
 end
0
\ No newline at end of file

Comments

    No one has commented yet.