https://bugs.kde.org/show_bug.cgi?id=441507

            Bug ID: 441507
           Summary: Improve specific logging messages
           Product: ktorrent
           Version: 21.08.0
          Platform: unspecified
                OS: Linux
            Status: REPORTED
          Severity: minor
          Priority: NOR
         Component: general
          Assignee: joris.guis...@gmail.com
          Reporter: alt.j4-82x1...@yopmail.com
  Target Milestone: ---

SUMMARY
Lack of a port number in the logs is making it difficult to debug connections
at the user level.

STEPS TO REPRODUCE
null - direct code citation

OBSERVED RESULT
ktorrent's log file shows messages like

Authentication(S) to 149.112.112.112 : failure
Authentication to 149.112.112.112: failure
Initiating connection to 149.112.112.112 via (TCP)

EXPECTED RESULT
Messages should include the whole connection address including port.

Authentication(S) to 149.112.112.112:52142 : failure
Authentication to 149.112.112.112:30177 : failure
Initiating connection to 149.112.112.112:52142 via (TCP)

CITATION
Line 46 in libktorrent's src/peer/serverauthenticate.cpp could be changed from

    Out(SYS_CON | LOG_NOTICE) << "Authentication(S) to " <<
sock->getRemoteIPAddress() << " : " << (succes ? "ok" : "failure") << endl;

most easily to something like

    Out(SYS_CON | LOG_NOTICE) << "Authentication(S) to " <<
sock->getRemoteIPAddress() << ":" << sock->getRemotePort() << " : " << (succes
? "ok" : "failure") << endl;

Though getRemotePort() returns a bt::Uint16 so there could be some typecasting
involved.
getRemoteIPAddress() was probably used because it returns a QString so it was
easy.
getRemoteAddress() won't work because it returns a net::Address, which has a
toString() which does not include the port.
These are all members of src/mse/EncryptedPacketSocket

Line 139 of src/peer/authenticate.cpp uses net::Address.toString(), which is
how I know it doesn't include the port

    Out(SYS_CON | LOG_NOTICE) << "Authentication to " << addr.toString() << " :
" << (succes ? "ok" : "failure") << endl;

Line 43 of the same file authenticate.cpp could also use the same help

    Out(SYS_CON | LOG_NOTICE) << "Initiating connection to " << addr.toString()
<< " via (" << (proto == TCP ? "TCP" : "UTP") << ")" << endl;

Alternatively net:Address's toString() could be overridden.


SOFTWARE/OS VERSIONS
Investigated invent.kde.org master branch 2021-08-24

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to