rename tr_torrentClose() as tr_torrentFree() and make it private. change client code to use tr_torrentRemove() instead. This fixes the confusion between the two methods that led to #954

This commit is contained in:
Charles Kerr
2008-05-21 17:14:58 +00:00
parent 132a4b7243
commit e406dcc2ab
9 changed files with 10 additions and 37 deletions
+1 -7
View File
@@ -119,13 +119,7 @@ TRWindow::TRWindow() : BWindow(BRect(10, 40, 350, 110), "Transmission", B_TITLED
Show();
}
static void torrentclose(tr_torrent_t *torrent, void *)
{
tr_torrentClose(torrent);
}
TRWindow::~TRWindow() {
tr_torrentIterate(engine, torrentclose, NULL);
const int MAX_EXIT_WAIT_SECS = 10;
const time_t deadline = time(0) + MAX_EXIT_WAIT_SECS;
while (tr_torrentCount(engine) && time(NULL) < deadline) {
@@ -353,7 +347,7 @@ void TRWindow::MessageReceived(BMessage *msg) {
// Remove the file from the filesystem.
TRTransfer *item = (TRTransfer*)transfers->RemoveItem(index);
tr_torrentClose(item->GetTorrent());
tr_torrentRemove(item->GetTorrent());
BEntry *entry = new BEntry(item->GetCachedPath(), true);
entry->Remove();
delete entry;
-1
View File
@@ -373,7 +373,6 @@ main( int argc, char ** argv )
}
cleanup:
tr_torrentClose( tor );
tr_sessionClose( h );
return EXIT_SUCCESS;
-1
View File
@@ -65,7 +65,6 @@
Method name | libtransmission function
--------------------+-------------------------------------------------
"torrent-close" | tr_torrentClose
"torrent-remove" | tr_torrentRemove
"torrent-start" | tr_torrentStart
"torrent-stop" | tr_torrentStop
+1 -1
View File
@@ -81,7 +81,7 @@ tr_torrent_dispose( GObject * o )
if( self->priv->do_remove )
tr_torrentRemove( self->priv->handle );
else
tr_torrentClose( self->priv->handle );
tr_torrentFree( self->priv->handle );
}
self->priv = NULL;
-16
View File
@@ -120,21 +120,6 @@ torrentStop( tr_handle * h, tr_benc * args_in, tr_benc * args_out UNUSED )
return NULL;
}
static const char*
torrentClose( tr_handle * h, tr_benc * args_in, tr_benc * args_out UNUSED )
{
int i, torrentCount;
tr_torrent ** torrents = getTorrents( h, args_in, &torrentCount );
for( i=0; i<torrentCount; ++i )
{
tr_torrent * tor = torrents[i];
notify( h, TR_RPC_TORRENT_CLOSING, tor );
tr_torrentClose( tor );
}
tr_free( torrents );
return NULL;
}
static const char*
torrentRemove( tr_handle * h, tr_benc * args_in, tr_benc * args_out UNUSED )
{
@@ -683,7 +668,6 @@ struct method {
{ "session-get", sessionGet },
{ "session-set", sessionSet },
{ "torrent-add", torrentAdd },
{ "torrent-close", torrentClose },
{ "torrent-get-priorities", torrentGetPriorities },
{ "torrent-get", torrentGet },
{ "torrent-info", torrentInfo },
+1 -1
View File
@@ -425,7 +425,7 @@ tr_closeAllConnections( void * vh )
tr_rpcClose( &h->rpcServer );
while(( tor = tr_torrentNext( h, NULL )))
tr_torrentClose( tor );
tr_torrentFree( tor );
tr_peerMgrFree( h->peerMgr );
+2 -2
View File
@@ -1118,7 +1118,7 @@ closeTorrent( void * vtor )
}
void
tr_torrentClose( tr_torrent * tor )
tr_torrentFree( tr_torrent * tor )
{
if( tor != NULL )
{
@@ -1136,7 +1136,7 @@ void
tr_torrentRemove( tr_torrent * tor )
{
tor->isDeleting = 1;
tr_torrentClose( tor );
tr_torrentFree( tor );
}
+3 -4
View File
@@ -743,12 +743,11 @@ void tr_torrentVerify( tr_torrent * );
* Frees memory allocated by tr_torrentNew().
* Running torrents are stopped first.
*/
void tr_torrentClose( tr_torrent * );
void tr_torrentFree( tr_torrent * );
/**
* Like tr_torrentClose() but also deletes
* the resume file and our copy of the
* torrent file
* Removes our .torrent and .resume files for this
* torrent, then calls tr_torrentFree()
*/
void tr_torrentRemove( tr_torrent * );
+2 -4
View File
@@ -327,10 +327,8 @@ MyFrame :: OnRemoveUpdate( wxUpdateUIEvent& event )
void
MyFrame :: OnRemove( wxCommandEvent& WXUNUSED(unused) )
{
foreach( torrents_v, mySelectedTorrents, it ) {
tr_torrentRemoveSaved( *it );
tr_torrentClose( *it );
}
foreach( torrents_v, mySelectedTorrents, it )
tr_torrentRemove( *it );
}
/**