Software /
code /
prosody
Annotate
plugins/mod_debug_sql.lua @ 12468:353836684009
net.connect: Fix accumulation of connection attempt references
Connection attempts that failed the Happy Eyeballs race were not
unreferenced and would accumulate.
Tested by inspecting the 'pending_connections_map' after establishing
s2s with a s2s target where the IPv6 port has a -j DROP rule causing it
to time out and the IPv4 attempt wins the race.
Expected is that the losing connection stays around until net.server
timeouts kick in where it should be removed. The map table should tend
towards being empty during idle times.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 20 Apr 2022 22:41:54 +0200 |
parent | 8391:5edb0d01a94f |
rev | line source |
---|---|
7176
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 -- Enables SQL query logging |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 -- |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 -- luacheck: ignore 213/uri |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 |
8391
5edb0d01a94f
mod_debug_sql: Declare itself as global module
Kim Alvefur <zash@zash.se>
parents:
7176
diff
changeset
|
5 module:set_global(); |
5edb0d01a94f
mod_debug_sql: Declare itself as global module
Kim Alvefur <zash@zash.se>
parents:
7176
diff
changeset
|
6 |
7176
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 local engines = module:shared("/*/sql/connections"); |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 for uri, engine in pairs(engines) do |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 engine:debug(true); |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 end |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 setmetatable(engines, { |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 __newindex = function (t, uri, engine) |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 engine:debug(true); |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 rawset(t, uri, engine); |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 end |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 }); |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 function module.unload() |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 setmetatable(engines, nil); |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 for uri, engine in pairs(engines) do |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 engine:debug(false); |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 end |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
25 end |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 |
b8bbd5f91ad9
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
27 |