Commit f95fb79
committed
Merge bitcoin/bitcoin#28521: net, net_processing: additional and consistent disconnect logging
06443b8 net: clarify if we ever sent or received from peer (Sjors Provoost)
1d01ad4 net: add LogIP() helper, use in net_processing (Sjors Provoost)
937ef9e net_processing: use CNode::DisconnectMsg helper (Sjors Provoost)
ad22442 net: additional disconnection logging (Sjors Provoost)
Pull request description:
While debugging unexpected disconnections, possibly related to #28331, I found some additional [net] logging to be useful.
All cases where we disconnect now come with a log message that has the word `disconnecting`:
* all calls to `CloseSocketDisconnect()` log `disconnecting peer=…`
* wherever we set `pnode->fDisconnect = true;`
* for all `InactivityCheck` cases (which in turn sets `fDisconnect`)
* replaces "dropping" with "disconnecting" in `Network not active, dropping peer=…`
A few exceptions are listed here: bitcoin/bitcoin#28521 (comment)
I changed `CloseSocketDisconnect()` to no longer log `disconnecting`, and instead have all the call sites do so.
This PR introduces two helper functions on `CNode`: `DisconnectMsg` and `LogIP`. The second and third commit use these helpers in `net_processing.cpp` so these disconnect messages are more consistent now (e.g. some didn't log the IP). No new messages are added there though.
The `LogIP()` helper is rarely used outside of a disconnect event, but it's available for future use.
Any `LogPrint` this PR touches is replaced with `LogDebug` (superseded by #30750), and every `LogPrintf ` with `LogInfo`.
ACKs for top commit:
davidgumberg:
reACK bitcoin/bitcoin@06443b8
vasild:
ACK 06443b8
danielabrozzoni:
ACK 06443b8
hodlinator:
ACK 06443b8
Tree-SHA512: 525f4c11568616e1d48455a3fcab9e923da7432377fe9230468c15403d2e9b7ce712112df8fbd547cfec01dce0d1f26107cfc1b90f78cfc1fe13e08d57b08464File tree
9 files changed
+123
-75
lines changed- src
- test/functional
9 files changed
+123
-75
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
558 | 558 | | |
559 | 559 | | |
560 | 560 | | |
561 | | - | |
562 | 561 | | |
563 | 562 | | |
564 | 563 | | |
| |||
696 | 695 | | |
697 | 696 | | |
698 | 697 | | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
699 | 710 | | |
700 | 711 | | |
701 | 712 | | |
| |||
1635 | 1646 | | |
1636 | 1647 | | |
1637 | 1648 | | |
1638 | | - | |
| 1649 | + | |
1639 | 1650 | | |
1640 | 1651 | | |
1641 | 1652 | | |
| |||
1879 | 1890 | | |
1880 | 1891 | | |
1881 | 1892 | | |
1882 | | - | |
| 1893 | + | |
1883 | 1894 | | |
1884 | 1895 | | |
1885 | 1896 | | |
| |||
1971 | 1982 | | |
1972 | 1983 | | |
1973 | 1984 | | |
1974 | | - | |
1975 | | - | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
1976 | 1998 | | |
1977 | 1999 | | |
1978 | 2000 | | |
1979 | 2001 | | |
1980 | | - | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
1981 | 2006 | | |
1982 | 2007 | | |
1983 | 2008 | | |
1984 | 2009 | | |
1985 | | - | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
1986 | 2014 | | |
1987 | 2015 | | |
1988 | 2016 | | |
1989 | 2017 | | |
1990 | 2018 | | |
1991 | | - | |
| 2019 | + | |
1992 | 2020 | | |
1993 | | - | |
| 2021 | + | |
1994 | 2022 | | |
1995 | 2023 | | |
1996 | 2024 | | |
| |||
2118 | 2146 | | |
2119 | 2147 | | |
2120 | 2148 | | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
2121 | 2153 | | |
2122 | 2154 | | |
2123 | 2155 | | |
| |||
2130 | 2162 | | |
2131 | 2163 | | |
2132 | 2164 | | |
2133 | | - | |
| 2165 | + | |
2134 | 2166 | | |
2135 | 2167 | | |
2136 | 2168 | | |
| |||
2141 | 2173 | | |
2142 | 2174 | | |
2143 | 2175 | | |
2144 | | - | |
| 2176 | + | |
2145 | 2177 | | |
2146 | 2178 | | |
2147 | 2179 | | |
| |||
3411 | 3443 | | |
3412 | 3444 | | |
3413 | 3445 | | |
| 3446 | + | |
3414 | 3447 | | |
3415 | 3448 | | |
3416 | 3449 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
947 | 947 | | |
948 | 948 | | |
949 | 949 | | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
950 | 966 | | |
951 | 967 | | |
952 | 968 | | |
| |||
0 commit comments