module DEBUGGER__::UI_DAP
def recv_request
def recv_request IO.select([@sock]) @session.process_group.sync do raise RetryBecauseCantRead unless IO.select([@sock], nil, nil, 0) case @sock.gets when /Content-Length: (\d+)/ b = @sock.read(2) raise b.inspect unless b == "\r\n" l = @sock.read($1.to_i) show_protocol :>, l JSON.load(l) when nil nil else raise "unrecognized line: #{l} (#{l.size} bytes)" end end rescue RetryBecauseCantRead retry end