Sha256: eb8961d61ac8976052e7a079cbf6fc849a6ce703f92aa61ac40618ba5ee0346e
Contents?: true
Size: 635 Bytes
Versions: 11
Compression:
Stored size: 635 Bytes
Contents
# encoding: utf-8 require "logstash/devutils/rspec/spec_helper" require 'logstash/inputs/unix' class UnixSocketHelper attr_reader :path def initialize @socket = nil end def new_socket(path) @path = path File.unlink if File.exists?(path) && File.socket?(path) @socket = UNIXServer.new(path) self end def loop(forever=false) @thread = Thread.new do begin s = @socket.accept s.puts "hi" while forever rescue Errno::EPIPE, Errno::ECONNRESET # ... end end self end def close @thread.kill @socket.close File.unlink(path) end end
Version data entries
11 entries across 11 versions & 1 rubygems