Class: Async::Container::Notify::Server::Context
- Inherits:
-
Object
- Object
- Async::Container::Notify::Server::Context
- Defined in:
- lib/async/container/notify/server.rb
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(path) ⇒ Context
constructor
A new instance of Context.
- #receive ⇒ Object
Constructor Details
#initialize(path) ⇒ Context
Returns a new instance of Context.
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/async/container/notify/server.rb', line 80 def initialize(path) @path = path @endpoint = IO::Endpoint.unix(@path, ::Socket::SOCK_DGRAM) Sync do @bound = @endpoint.bind end @state = {} end |
Instance Method Details
#close ⇒ Object
91 92 93 94 95 96 97 |
# File 'lib/async/container/notify/server.rb', line 91 def close Sync do @bound.close end File.unlink(@path) end |
#receive ⇒ Object
99 100 101 102 103 104 105 106 107 |
# File 'lib/async/container/notify/server.rb', line 99 def receive while true data, _address, _flags, *_controls = @bound.recvmsg(MAXIMUM_MESSAGE_SIZE) = Server.load(data) yield end end |