Class: RightScale::Windows::PipeServer
- Defined in:
- lib/chef/windows/pipe_server.rb
Overview
Provides a generic Windows named pipe server based on eventmachine.
Instance Method Summary collapse
-
#close ⇒ Object
Closes temporary file before closing pipe.
-
#disconnect ⇒ Object
Hack which fixes a bug with pending write never resetting pending_io flag, causing state machine never to reenter waiting state.
-
#fileno ⇒ Object
Hack which allows eventmachine to schedule I/O for this non-Ruby IO object.
Instance Method Details
#close ⇒ Object
Closes temporary file before closing pipe.
271 272 273 274 275 276 277 |
# File 'lib/chef/windows/pipe_server.rb', line 271 def close if @temp_file @temp_file.close @temp_file = nil end super.close end |
#disconnect ⇒ Object
Hack which fixes a bug with pending write never resetting pending_io flag, causing state machine never to reenter waiting state. also resets buffer which can be set to a small size by a tiny overlapped I/O operation.
264 265 266 267 268 |
# File 'lib/chef/windows/pipe_server.rb', line 264 def disconnect @pending_io = false @buffer = 0.chr * PIPE_BUFFER_SIZE super end |
#fileno ⇒ Object
Hack which allows eventmachine to schedule I/O for this non-Ruby IO object. EM needs a real file number, so this method uses a temporary file.
Returns
- fileno(Integer)
-
temporary file’s file number.
255 256 257 258 |
# File 'lib/chef/windows/pipe_server.rb', line 255 def fileno @temp_file = Tempfile.new("RS-pipe-server") unless @temp_file return @temp_file.fileno end |