wip: moar debug logs

This commit is contained in:
HoneyryderChuck 2025-07-11 17:37:54 +01:00
parent 37f3719888
commit 1c5bf34fe5
2 changed files with 37 additions and 23 deletions

View File

@ -34,7 +34,7 @@ module HTTPX
klass = klass.superclass
end
message = +"(pid:#{Process.pid}, " \
message = +"#{Time.now} - (pid:#{Process.pid}, " \
"tid:#{Thread.current.object_id}, " \
"fid:#{Fiber.current.object_id}, " \
"self:#{class_name}##{object_id}) "

View File

@ -141,6 +141,19 @@ module HTTPX
io.log(level: 2) { "[#{io.state}] registering for select (#{interests})#{" for #{interval} seconds" unless interval.nil?}" }
if interests.nil?
case io
when Resolver::Native
queries = io.instance_variable_get(:@queries)
io.log(level: 2) do
"[state:#{io.state}, " \
"family:#{io.family}, " \
"query:#{queries.keys}, " \
"pending?:#{!io.empty?}, " \
"contexts:#{queries.values.flat_map(&:pending).map(&:context).map(&:object_id)}, " \
"has no interest"
end
when Connection
parser = io.instance_variable_get(:@parser)
io.log(level: 2) do
@ -162,12 +175,13 @@ module HTTPX
"pending:#{parser.pending.size}, " \
"handshake-completed?: #{parser.instance_variable_get(:@handshake_completed)}, " \
"buffer-empty?: #{io.empty?}, " \
"last-in-progress-stream: #{streams.keys.max} (#{streams.size}), " \
"pings: #{pings.last} (#{pings.size})" \
"last-in-progress-stream: #{streams.values.map(&:id).max} (#{streams.size}), " \
"pings: #{pings.last.inspect} (#{pings.size})" \
"] #{parser.class}##{parser.object_id} has no interest"
end
end
end
end
if READABLE.include?(interests)
r = r.nil? ? io : (Array(r) << io)