Class: Textbringer::Server
- Inherits:
-
Object
- Object
- Textbringer::Server
- Defined in:
- lib/textbringer/commands/server.rb
Defined Under Namespace
Classes: ExistError, FrontObject
Instance Method Summary collapse
-
#initialize(uri) ⇒ Server
constructor
A new instance of Server.
- #start ⇒ Object
Constructor Details
#initialize(uri) ⇒ Server
Returns a new instance of Server.
34 35 36 |
# File 'lib/textbringer/commands/server.rb', line 34 def initialize(uri) @uri = uri end |
Instance Method Details
#start ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/textbringer/commands/server.rb', line 38 def start front = FrontObject.new = unix_domain? ? { UNIXFileMode: 0600 } : {} = .merge(CONFIG[:server_options] || {}) begin DRb.start_service(@uri, front, ) rescue Errno::EADDRINUSE if unix_domain? && !unix_domain_server_alive? # Remove the socket file in case another server died unexpectedly before. File.unlink(unix_domain_socket_path) DRb.start_service(@uri, front, ) else raise ExistError, "There is an existing Textbringer server" end end end |