Class: Straycall::Reporter::Client
- Inherits:
-
Object
- Object
- Straycall::Reporter::Client
- Defined in:
- lib/straycall/reporter/client.rb
Instance Method Summary collapse
- #backtrace(tid) ⇒ Object
- #close ⇒ Object
- #example ⇒ Object
-
#initialize(socket, timeout: 0.2) ⇒ Client
constructor
A new instance of Client.
- #notify_violation ⇒ Object
Constructor Details
Instance Method Details
#backtrace(tid) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/straycall/reporter/client.rb', line 29 def backtrace(tid) return unless @alive @mutex.synchronize do @socket.write(Protocol.backtrace_request(tid)) read_backtrace(tid) end rescue IOError, SystemCallError @alive = false nil end |
#close ⇒ Object
54 55 56 |
# File 'lib/straycall/reporter/client.rb', line 54 def close @socket.close unless @socket.closed? end |
#example ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/straycall/reporter/client.rb', line 16 def example return @example unless @alive @mutex.synchronize do @socket.write(Protocol.sync_request) read_ack @example end rescue IOError, SystemCallError @alive = false @example end |
#notify_violation ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/straycall/reporter/client.rb', line 41 def notify_violation @mutex.synchronize do if @alive @socket.write("VIOLATION\n") read_ack else @socket.write_nonblock("VIOLATION\n", exception: false) end end rescue IOError, SystemCallError @alive = false end |