]> granicus.if.org Git - transmission/commitdiff
(trunk libT) more debugging messages
authorCharles Kerr <charles@transmissionbt.com>
Sat, 24 Jan 2009 17:20:07 +0000 (17:20 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Sat, 24 Jan 2009 17:20:07 +0000 (17:20 +0000)
libtransmission/handshake.c
libtransmission/handshake.h
libtransmission/peer-io.c
libtransmission/peer-io.h
libtransmission/peer-mgr.c

index 0d8868fc210ae278f0a2cde9a6df9fc5263a5eda..1708c2a99de43131ec1a5b0faae1fe8d0ef5b5c8 100644 (file)
@@ -228,7 +228,7 @@ buildHandshakeMessage( tr_handshake * handshake,
 }
 
 static int tr_handshakeDone( tr_handshake * handshake,
-                             int            isConnected );
+                             tr_bool        isConnected );
 
 enum
 {
@@ -1078,7 +1078,7 @@ canRead( struct tr_peerIo * io, void * arg, size_t * piece )
 
 static int
 fireDoneFunc( tr_handshake * handshake,
-              int            isConnected )
+              tr_bool        isConnected )
 {
     const uint8_t * peer_id = isConnected && handshake->havePeerID
                               ? handshake->peer_id
@@ -1104,7 +1104,7 @@ tr_handshakeFree( tr_handshake * handshake )
 
 static int
 tr_handshakeDone( tr_handshake * handshake,
-                  int            isOK )
+                  tr_bool        isOK )
 {
     tr_bool success;
 
index a3f7d2e33de8eb46deff18516ce98600c49a15eb..7837d8066b3e176bda8ab8e2b6cffb2f46934687 100644 (file)
@@ -26,7 +26,7 @@ typedef struct tr_handshake tr_handshake;
 /* returns true on success, false on error */
 typedef tr_bool ( *handshakeDoneCB )( struct tr_handshake * handshake,
                                       struct tr_peerIo *    io,
-                                      int                   isConnected,
+                                      tr_bool               isConnected,
                                       const uint8_t *       peerId,
                                       void *                userData );
 
index e01b3e2cdff40416a43b5de8b2ebeec0358e2bcf..58631974eb01d40ed7f2c23f94f7ee352eb4b118 100644 (file)
@@ -450,25 +450,30 @@ tr_peerIoFree( tr_peerIo * io )
 }
 
 void
-tr_peerIoRef( tr_peerIo * io )
+tr_peerIoRefImpl( const char * file, int line, tr_peerIo * io )
 {
     assert( tr_isPeerIo( io ) );
 
+    dbgmsg( io, "%s:%d is incrementing the IO's refcount from %d to %d\n",
+                file, line, io->refCount, io->refCount+1 );
+
     ++io->refCount;
 }
 
 void
-tr_peerIoUnref( tr_peerIo * io )
+tr_peerIoUnrefImpl( const char * file, int line, tr_peerIo * io )
 {
     assert( tr_isPeerIo( io ) );
 
+    dbgmsg( io, "%s:%d is decrementing the IO's refcount from %d to %d\n",
+                file, line, io->refCount, io->refCount+1 );
+
     if( !--io->refCount )
         tr_peerIoFree( io );
 }
 
 const tr_address*
-tr_peerIoGetAddress( const tr_peerIo * io,
-                           tr_port   * port )
+tr_peerIoGetAddress( const tr_peerIo * io, tr_port   * port )
 {
     assert( tr_isPeerIo( io ) );
 
index f381488187e83c37e565685c219249ef2dbdc689..f3311838b441b401f350837d32f1b774e3855aae 100644 (file)
@@ -120,9 +120,17 @@ tr_peerIo*  tr_peerIoNewIncoming( tr_session              * session,
                                   tr_port                   port,
                                   int                       socket );
 
-void tr_peerIoRef               ( tr_peerIo * io );
+void tr_peerIoRefImpl           ( const char              * file,
+                                  int                       line,
+                                  tr_peerIo               * io );
 
-void tr_peerIoUnref             ( tr_peerIo * io );
+#define tr_peerIoRef(io) tr_peerIoRefImpl( __FILE__, __LINE__, (io) );
+
+void tr_peerIoUnrefImpl         ( const char              * file,
+                                  int                       line,
+                                  tr_peerIo               * io );
+
+#define tr_peerIoUnref(io) tr_peerIoUnrefImpl( __FILE__, __LINE__, (io) );
 
 tr_bool     tr_isPeerIo         ( const tr_peerIo         * io );
 
index 6fec34111d824a7618c53c43a08c4f42d0ed5382..a64c377c1954ad74669c02cbb4d0d7e297c0364a 100644 (file)
@@ -1160,7 +1160,7 @@ getPeerCount( const Torrent * t )
 static tr_bool
 myHandshakeDoneCB( tr_handshake  * handshake,
                    tr_peerIo     * io,
-                   int             isConnected,
+                   tr_bool         isConnected,
                    const uint8_t * peer_id,
                    void          * vmanager )
 {
@@ -1173,7 +1173,7 @@ myHandshakeDoneCB( tr_handshake  * handshake,
     tr_handshake     * ours;
 
     assert( io );
-    assert( isConnected == 0 || isConnected == 1 );
+    assert( tr_isBool( ok ) );
 
     t = tr_peerIoHasTorrentHash( io )
         ? getExistingTorrent( manager, tr_peerIoGetTorrentHash( io ) )