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.
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/async/container/notify/server.rb', line 63 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
74 75 76 77 78 79 80 |
# File 'lib/async/container/notify/server.rb', line 74 def close Sync do @bound.close end File.unlink(@path) end |
#receive ⇒ Object
82 83 84 85 86 87 88 89 90 |
# File 'lib/async/container/notify/server.rb', line 82 def receive while true data, _address, _flags, *_controls = @bound.recvmsg(MAXIMUM_MESSAGE_SIZE) = Server.load(data) yield end end |