Module: Rpush::Daemon
- Defined in:
- lib/rpush/daemon.rb,
lib/rpush/daemon/adm.rb,
lib/rpush/daemon/gcm.rb,
lib/rpush/daemon/rpc.rb,
lib/rpush/daemon/wns.rb,
lib/rpush/daemon/apns.rb,
lib/rpush/daemon/wpns.rb,
lib/rpush/daemon/apns2.rb,
lib/rpush/daemon/batch.rb,
lib/rpush/daemon/pushy.rb,
lib/rpush/daemon/apnsp8.rb,
lib/rpush/daemon/feeder.rb,
lib/rpush/daemon/delivery.rb,
lib/rpush/daemon/loggable.rb,
lib/rpush/daemon/constants.rb,
lib/rpush/daemon/app_runner.rb,
lib/rpush/daemon/proc_title.rb,
lib/rpush/daemon/rpc/client.rb,
lib/rpush/daemon/rpc/server.rb,
lib/rpush/daemon/ring_buffer.rb,
lib/rpush/daemon/store/redis.rb,
lib/rpush/daemon/adm/delivery.rb,
lib/rpush/daemon/apnsp8/token.rb,
lib/rpush/daemon/gcm/delivery.rb,
lib/rpush/daemon/synchronizer.rb,
lib/rpush/daemon/wns/delivery.rb,
lib/rpush/daemon/apns/delivery.rb,
lib/rpush/daemon/queue_payload.rb,
lib/rpush/daemon/wpns/delivery.rb,
lib/rpush/daemon/apns2/delivery.rb,
lib/rpush/daemon/dispatcher/tcp.rb,
lib/rpush/daemon/pushy/delivery.rb,
lib/rpush/daemon/signal_handler.rb,
lib/rpush/daemon/string_helpers.rb,
lib/rpush/daemon/tcp_connection.rb,
lib/rpush/daemon/apnsp8/delivery.rb,
lib/rpush/daemon/dispatcher/http.rb,
lib/rpush/daemon/dispatcher_loop.rb,
lib/rpush/daemon/store/interface.rb,
lib/rpush/daemon/wns/raw_request.rb,
lib/rpush/daemon/wns/post_request.rb,
lib/rpush/daemon/wns/badge_request.rb,
lib/rpush/daemon/wns/toast_request.rb,
lib/rpush/daemon/dispatcher/apns_tcp.rb,
lib/rpush/daemon/interruptible_sleep.rb,
lib/rpush/daemon/retry_header_parser.rb,
lib/rpush/daemon/store/active_record.rb,
lib/rpush/daemon/dispatcher/apns_http2.rb,
lib/rpush/daemon/apns/feedback_receiver.rb,
lib/rpush/daemon/service_config_methods.rb,
lib/rpush/daemon/dispatcher/apnsp8_http2.rb,
lib/rpush/daemon/store/active_record/reconnectable.rb
Defined Under Namespace
Modules: Adm, Apns, Apns2, Apnsp8, Dispatcher, Gcm, Loggable, Pushy, Rpc, ServiceConfigMethods, Store, StringHelpers, Wns, Wpns
Classes: AppRunner, Batch, Delivery, DispatcherLoop, Feeder, InterruptibleSleep, ProcTitle, QueuePayload, RetryHeaderParser, RingBuffer, SignalHandler, Synchronizer, TcpConnection, TcpConnectionError
Constant Summary
collapse
- HTTP_STATUS_CODES =
{
100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing',
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
204 => 'No Content',
205 => 'Reset Content',
206 => 'Partial Content',
207 => 'Multi-Status',
226 => 'IM Used',
300 => 'Multiple Choices',
301 => 'Moved Permanently',
302 => 'Found',
303 => 'See Other',
304 => 'Not Modified',
305 => 'Use Proxy',
306 => 'Reserved',
307 => 'Temporary Redirect',
400 => 'Bad Request',
401 => 'Unauthorized',
402 => 'Payment Required',
403 => 'Forbidden',
404 => 'Not Found',
405 => 'Method Not Allowed',
406 => 'Not Acceptable',
407 => 'Proxy Authentication Required',
408 => 'Request Timeout',
409 => 'Conflict',
410 => 'Gone',
411 => 'Length Required',
412 => 'Precondition Failed',
413 => 'Request Entity Too Large',
414 => 'Request-URI Too Long',
415 => 'Unsupported Media Type',
416 => 'Requested Range Not Satisfiable',
417 => 'Expectation Failed',
418 => "I'm a Teapot",
422 => 'Unprocessable Entity',
423 => 'Locked',
424 => 'Failed Dependency',
426 => 'Upgrade Required',
429 => 'Too Many Requests',
500 => 'Internal Server Error',
501 => 'Not Implemented',
502 => 'Bad Gateway',
503 => 'Service Unavailable',
504 => 'Gateway Timeout',
505 => 'HTTP Version Not Supported',
506 => 'Variant Also Negotiates',
507 => 'Insufficient Storage',
510 => 'Not Extended'
}
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.store ⇒ Object
Returns the value of attribute store.
74
75
76
|
# File 'lib/rpush/daemon.rb', line 74
def store
@store
end
|
Class Method Details
.common_init ⇒ Object
120
121
122
123
|
# File 'lib/rpush/daemon.rb', line 120
def self.common_init
init_store
init_plugins
end
|
.shutdown ⇒ Object
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
# File 'lib/rpush/daemon.rb', line 98
def self.shutdown
if Rpush.config.foreground
STDOUT.write("\b\b")
STDOUT.flush
end
Rpush.logger.info('Shutting down... ', true)
shutdown_lock.synchronize do
Rpc::Server.stop
Feeder.stop
AppRunner.stop
delete_pid_file
puts Rainbow('✔').red if Rpush.config.foreground
end
end
|
.shutdown_lock ⇒ Object
116
117
118
|
# File 'lib/rpush/daemon.rb', line 116
def self.shutdown_lock
@shutdown_lock ||= Mutex.new
end
|
.start ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
# File 'lib/rpush/daemon.rb', line 77
def self.start
Process.daemon if daemonize?
write_pid_file
SignalHandler.start
common_init
Synchronizer.sync
Rpc::Server.start
store.release_connection
Rpush.logger.info('Rpush operational.')
show_welcome_if_needed
Feeder.start
shutdown_lock.synchronize { true }
end
|