1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 20:15:07 +00:00

Everywhere: Replace a bundle of dbg with dbgln.

These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
This commit is contained in:
asynts 2021-01-14 22:37:57 +01:00 committed by Andreas Kling
parent dd727d1fec
commit c6ebca5b45
8 changed files with 68 additions and 106 deletions

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/Singleton.h>
#include <AK/Time.h>
#include <Kernel/Devices/RandomDevice.h>
@ -48,9 +49,7 @@ void TCPSocket::for_each(Function<void(const TCPSocket&)> callback)
void TCPSocket::set_state(State new_state)
{
#ifdef TCP_SOCKET_DEBUG
dbg() << "TCPSocket{" << this << "} state moving from " << to_string(m_state) << " to " << to_string(new_state);
#endif
dbgln<debug_tcp_socket>("TCPSocket({}) state moving from {} to {}", this, to_string(m_state), to_string(new_state));
auto was_disconnected = protocol_is_disconnected();
auto previous_role = m_role;
@ -157,9 +156,7 @@ TCPSocket::~TCPSocket()
LOCKER(sockets_by_tuple().lock());
sockets_by_tuple().resource().remove(tuple());
#ifdef TCP_SOCKET_DEBUG
dbg() << "~TCPSocket in state " << to_string(state());
#endif
dbgln<debug_tcp_socket>("~TCPSocket in state {}", to_string(state()));
}
NonnullRefPtr<TCPSocket> TCPSocket::create(int protocol)
@ -278,18 +275,14 @@ void TCPSocket::receive_tcp_packet(const TCPPacket& packet, u16 size)
if (packet.has_ack()) {
u32 ack_number = packet.ack_number();
#ifdef TCP_SOCKET_DEBUG
dbg() << "TCPSocket: receive_tcp_packet: " << ack_number;
#endif
dbgln<debug_tcp_socket>("TCPSocket: receive_tcp_packet: {}", ack_number);
int removed = 0;
LOCKER(m_not_acked_lock);
while (!m_not_acked.is_empty()) {
auto& packet = m_not_acked.first();
#ifdef TCP_SOCKET_DEBUG
dbg() << "TCPSocket: iterate: " << packet.ack_number;
#endif
dbgln<debug_tcp_socket>("TCPSocket: iterate: {}", packet.ack_number);
if (packet.ack_number <= ack_number) {
m_not_acked.take_first();
@ -299,9 +292,7 @@ void TCPSocket::receive_tcp_packet(const TCPPacket& packet, u16 size)
}
}
#ifdef TCP_SOCKET_DEBUG
dbg() << "TCPSocket: receive_tcp_packet acknowledged " << removed << " packets";
#endif
dbgln<debug_tcp_socket>("TCPSocket: receive_tcp_packet acknowledged {} packets", removed);
}
m_packets_in++;