Browse files

Merge branch 'svn/trunk'

  • Loading branch information...
2 parents 3ec99a1 + 78dc4ec commit 8df6bd8cb0245c22448c14ba294ff4ef985447e8 @ijuxda committed Feb 19, 2011
View
2 configure.ac
@@ -200,7 +200,7 @@ AC_ARG_ENABLE([utp],
[build_utp=no])
if test "x$build_utp" = "xyes" ; then
LIBUTP_CFLAGS="-I\$(top_srcdir)/third-party/"
- LIBUTP_LIBS="\$(top_builddir)/third-party/libutp/libutp.a"
+ LIBUTP_LIBS="\$(top_builddir)/third-party/libutp/libutp.a -lrt"
AC_DEFINE([WITH_UTP],[1])
fi
AC_SUBST(LIBUTP_CFLAGS)
View
30 gtk/details.c
@@ -1105,6 +1105,7 @@ enum
PEER_COL_REQS_CANCELLED_BY_PEER_COUNT_STRING,
PEER_COL_ENCRYPTION_STOCK_ID,
PEER_COL_FLAGS,
+ PEER_COL_TORRENT_NAME,
N_PEER_COLS
};
@@ -1164,13 +1165,15 @@ peer_store_new( void )
G_TYPE_INT, /* # blocks cancelled by peer int */
G_TYPE_STRING, /* # blocks cancelled by peer string */
G_TYPE_STRING, /* encryption stock id */
- G_TYPE_STRING); /* flagString */
+ G_TYPE_STRING, /* flagString */
+ G_TYPE_STRING); /* torrent name */
}
static void
initPeerRow( GtkListStore * store,
GtkTreeIter * iter,
const char * key,
+ const char * torrentName,
const tr_peer_stat * peer )
{
int q[4];
@@ -1192,6 +1195,7 @@ initPeerRow( GtkListStore * store,
PEER_COL_CLIENT, client,
PEER_COL_ENCRYPTION_STOCK_ID, peer->isEncrypted ? "transmission-lock" : NULL,
PEER_COL_KEY, key,
+ PEER_COL_TORRENT_NAME, torrentName,
-1 );
}
@@ -1290,7 +1294,7 @@ refreshPeerList( struct DetailsImpl * di, tr_torrent ** torrents, int n )
if( g_hash_table_lookup( hash, key ) == NULL ) {
GtkTreePath * p;
gtk_list_store_append( store, &iter );
- initPeerRow( store, &iter, key, s );
+ initPeerRow( store, &iter, key, tr_torrentName( tor ), s );
p = gtk_tree_model_get_path( model, &iter );
g_hash_table_insert( hash, g_strdup( key ),
gtk_tree_row_reference_new( model, p ) );
@@ -1464,10 +1468,18 @@ onPeerViewQueryTooltip( GtkWidget * widget,
&model, NULL, &iter ) )
{
const char * pch;
- char * str = NULL;
- GString * gstr = g_string_new( NULL );
- gtk_tree_model_get( model, &iter, PEER_COL_FLAGS, &str, -1 );
- for( pch = str; pch && *pch; ++pch )
+ char * name = NULL;
+ char * addr = NULL;
+ char * flagstr = NULL;
+ GString * gstr = g_string_new( NULL );
+ gtk_tree_model_get( model, &iter, PEER_COL_TORRENT_NAME, &name,
+ PEER_COL_ADDRESS, &addr,
+ PEER_COL_FLAGS, &flagstr,
+ -1 );
+
+ g_string_append_printf( gstr, "<b>%s</b>\n%s\n \n", name, addr );
+
+ for( pch = flagstr; pch && *pch; ++pch )
{
const char * s = NULL;
switch( *pch )
@@ -1490,9 +1502,11 @@ onPeerViewQueryTooltip( GtkWidget * widget,
}
if( gstr->len ) /* remove the last linefeed */
g_string_set_size( gstr, gstr->len - 1 );
- gtk_tooltip_set_text( tooltip, gstr->str );
+ gtk_tooltip_set_markup( tooltip, gstr->str );
g_string_free( gstr, TRUE );
- g_free( str );
+ g_free( flagstr );
+ g_free( addr );
+ g_free( name );
show_tip = TRUE;
}
View
13 gtk/tr-prefs.c
@@ -457,6 +457,15 @@ onBlocklistUpdate( GtkButton * w, gpointer gdata )
}
static void
+on_blocklist_url_changed( GtkEditable * e, gpointer gbutton )
+{
+ gchar * url = gtk_editable_get_chars( e, 0, -1 );
+ const gboolean err = tr_urlParse( url, -1, NULL, NULL, NULL, NULL );
+ gtk_widget_set_sensitive( GTK_WIDGET( gbutton ), !err );
+ g_free( url );
+}
+
+static void
onIntComboChanged( GtkComboBox * combo_box, gpointer core )
{
const int val = gtr_combo_box_get_active_enum( combo_box );
@@ -516,6 +525,8 @@ privacyPage( GObject * core )
gtk_box_pack_start( GTK_BOX( h ), b, FALSE, FALSE, 0 );
g_signal_connect( data->check, "toggled", G_CALLBACK( target_cb ), w ); target_cb( data->check, w );
hig_workarea_add_wide_control( t, &row, h );
+ g_signal_connect( e, "changed", G_CALLBACK( on_blocklist_url_changed ), data->updateBlocklistButton );
+ on_blocklist_url_changed( GTK_EDITABLE( e ), data->updateBlocklistButton );
s = _( "Enable _automatic updates" );
w = new_check_button( s, PREF_KEY_BLOCKLIST_UPDATES_ENABLED, core );
@@ -1357,10 +1368,10 @@ networkPage( GObject * core )
w = new_spin_button( TR_PREFS_KEY_PEER_LIMIT_GLOBAL, core, 1, 3000, 5 );
hig_workarea_add_row( t, &row, _( "Maximum peers _overall:" ), w, NULL );
-#ifdef WITH_UTP
hig_workarea_add_section_divider( t, &row );
hig_workarea_add_section_title( t, &row, _( "Options" ) );
+#ifdef WITH_UTP
s = _( "Enable _uTP for peer communication" );
w = new_check_button( s, TR_PREFS_KEY_UTP_ENABLED, core );
s = _( "uTP is a tool for reducing network congestion." );
View
69 libtransmission/peer-mgr.c
@@ -3086,15 +3086,7 @@ rechokePulse( int foo UNUSED, short bar UNUSED, void * vmgr )
****
***/
-typedef enum
-{
- TR_CAN_KEEP,
- TR_CAN_CLOSE,
- TR_MUST_CLOSE,
-}
-tr_close_type_t;
-
-static tr_close_type_t
+static tr_bool
shouldPeerBeClosed( const Torrent * t,
const tr_peer * peer,
int peerCount,
@@ -3108,7 +3100,7 @@ shouldPeerBeClosed( const Torrent * t,
{
tordbg( t, "purging peer %s because its doPurge flag is set",
tr_atomAddrStr( atom ) );
- return TR_MUST_CLOSE;
+ return TRUE;
}
/* if we're seeding and the peer has everything we have,
@@ -3133,7 +3125,7 @@ shouldPeerBeClosed( const Torrent * t,
{
tordbg( t, "purging peer %s because we're both seeds",
tr_atomAddrStr( atom ) );
- return TR_MUST_CLOSE;
+ return TRUE;
}
}
@@ -3154,19 +3146,15 @@ shouldPeerBeClosed( const Torrent * t,
if( idleTime > limit ) {
tordbg( t, "purging peer %s because it's been %d secs since we shared anything",
tr_atomAddrStr( atom ), idleTime );
- return TR_CAN_CLOSE;
+ return TRUE;
}
}
- return TR_CAN_KEEP;
+ return FALSE;
}
-static void sortPeersByLivelinessReverse( tr_peer ** peers, void ** clientData, int n, uint64_t now );
-
static tr_peer **
-getPeersToClose( Torrent * t, tr_close_type_t closeType,
- const uint64_t now_msec, const time_t now_sec,
- int * setmeSize )
+getPeersToClose( Torrent * t, const time_t now_sec, int * setmeSize )
{
int i, peerCount, outsize;
tr_peer ** peers = (tr_peer**) tr_ptrArrayPeek( &t->peers, &peerCount );
@@ -3175,11 +3163,9 @@ getPeersToClose( Torrent * t, tr_close_type_t closeType,
assert( torrentIsLocked( t ) );
for( i = outsize = 0; i < peerCount; ++i )
- if( shouldPeerBeClosed( t, peers[i], peerCount, now_sec ) == closeType )
+ if( shouldPeerBeClosed( t, peers[i], peerCount, now_sec ) )
ret[outsize++] = peers[i];
- sortPeersByLivelinessReverse ( ret, NULL, outsize, now_msec );
-
*setmeSize = outsize;
return ret;
}
@@ -3272,24 +3258,14 @@ removeAllPeers( Torrent * t )
}
static void
-closeBadPeers( Torrent * t, const uint64_t now_msec, const time_t now_sec )
+closeBadPeers( Torrent * t, const time_t now_sec )
{
- if( !t->isRunning )
- {
- removeAllPeers( t );
- }
- else
- {
- int i;
- int mustCloseCount;
- struct tr_peer ** mustClose;
-
- /* disconnect the really bad peers */
- mustClose = getPeersToClose( t, TR_MUST_CLOSE, now_msec, now_sec, &mustCloseCount );
- for( i=0; i<mustCloseCount; ++i )
- closePeer( t, mustClose[i] );
- tr_free( mustClose );
- }
+ int i;
+ int peerCount;
+ struct tr_peer ** peers = getPeersToClose( t, now_sec, &peerCount );
+ for( i=0; i<peerCount; ++i )
+ closePeer( t, peers[i] );
+ tr_free( peers );
}
struct peer_liveliness
@@ -3325,12 +3301,6 @@ comparePeerLiveliness( const void * va, const void * vb )
return 0;
}
-static int
-comparePeerLivelinessReverse( const void * va, const void * vb )
-{
- return -comparePeerLiveliness (va, vb);
-}
-
static void
sortPeersByLivelinessImpl( tr_peer ** peers,
void ** clientData,
@@ -3378,12 +3348,6 @@ sortPeersByLiveliness( tr_peer ** peers, void ** clientData, int n, uint64_t now
sortPeersByLivelinessImpl( peers, clientData, n, now, comparePeerLiveliness );
}
-static void
-sortPeersByLivelinessReverse( tr_peer ** peers, void ** clientData, int n, uint64_t now )
-{
- sortPeersByLivelinessImpl( peers, clientData, n, now, comparePeerLivelinessReverse );
-}
-
static void
enforceTorrentPeerLimit( Torrent * t, uint64_t now )
@@ -3470,7 +3434,10 @@ reconnectPulse( int foo UNUSED, short bar UNUSED, void * vmgr )
/* remove crappy peers */
tor = NULL;
while(( tor = tr_torrentNext( mgr->session, tor )))
- closeBadPeers( tor->torrentPeers, now_msec, now_sec );
+ if( !tor->torrentPeers->isRunning )
+ removeAllPeers( tor->torrentPeers );
+ else
+ closeBadPeers( tor->torrentPeers, now_sec );
/* try to make new peer connections */
makeNewPeerConnections( mgr, MAX_CONNECTIONS_PER_PULSE );
View
14 libtransmission/torrent.c
@@ -2808,8 +2808,8 @@ tr_torrentDeleteLocalData( tr_torrent * tor, tr_fileFunc fileFunc )
struct LocationData
{
tr_bool move_from_old_location;
- int * setme_state;
- double * setme_progress;
+ volatile int * setme_state;
+ volatile double * setme_progress;
char * location;
tr_torrent * tor;
};
@@ -2905,11 +2905,11 @@ setLocation( void * vdata )
}
void
-tr_torrentSetLocation( tr_torrent * tor,
- const char * location,
- tr_bool move_from_old_location,
- double * setme_progress,
- int * setme_state )
+tr_torrentSetLocation( tr_torrent * tor,
+ const char * location,
+ tr_bool move_from_old_location,
+ volatile double * setme_progress,
+ volatile int * setme_state )
{
struct LocationData * data;
View
10 libtransmission/transmission.h
@@ -1122,11 +1122,11 @@ enum
* will be clobberred s.t. additional files being added will be saved
* to the torrent's downloadDir.
*/
-void tr_torrentSetLocation( tr_torrent * torrent,
- const char * location,
- tr_bool move_from_previous_location,
- double * setme_progress,
- int * setme_state );
+void tr_torrentSetLocation( tr_torrent * torrent,
+ const char * location,
+ tr_bool move_from_previous_location,
+ volatile double * setme_progress,
+ volatile int * setme_state );
uint64_t tr_torrentGetBytesLeftToAllocate( const tr_torrent * torrent );
View
4 macosx/InfoWindow.xib
@@ -12,7 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="6"/>
+ <integer value="5"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -685,7 +685,6 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA</bytes>
<string>1726.IBPluginDependency</string>
<string>1830.IBPluginDependency</string>
<string>1830.IBViewBoundsToFrameTransform</string>
- <string>1832.CustomClassName</string>
<string>1832.IBPluginDependency</string>
<string>1832.IBViewBoundsToFrameTransform</string>
<string>1832.ImportedFromIB2</string>
@@ -745,7 +744,6 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA</bytes>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">AUOLAAAAAAAAA</bytes>
</object>
- <string>InfoTextField</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABA4AAAwmgAAA</bytes>
View
3 macosx/PeerProgressIndicatorCell.m
@@ -81,7 +81,8 @@ - (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) controlView
NSImage * checkImage = [NSImage imageNamed: @"CompleteCheck.png"];
const NSSize imageSize = [checkImage size];
- const NSRect rect = NSMakeRect(NSMidX(cellFrame) - imageSize.width * 0.5, NSMidY(cellFrame) - imageSize.height * 0.5,
+ const NSRect rect = NSMakeRect(floor(NSMidX(cellFrame) - imageSize.width * 0.5),
+ floor(NSMidY(cellFrame) - imageSize.height * 0.5),
imageSize.width, imageSize.height);
if ([NSApp isOnSnowLeopardOrBetter])
View
2 qt/qtr.pro
@@ -23,7 +23,7 @@ LIBS += $${TRANSMISSION_TOP}/third-party/libutp/libutp.a
LIBS += $${TRANSMISSION_TOP}/third-party/dht/libdht.a
LIBS += $${TRANSMISSION_TOP}/third-party/miniupnp/libminiupnp.a
LIBS += $${TRANSMISSION_TOP}/third-party/libnatpmp/libnatpmp.a
-unix: LIBS += -L$${EVENT_TOP}/lib -levent -lz
+unix: LIBS += -L$${EVENT_TOP}/lib -levent -lz -lrt
win32:DEFINES += QT_DBUS
win32:LIBS += -levent -lws2_32 -lintl
win32:LIBS += -lidn -liconv -lwldap32 -liphlpapi
View
3 third-party/libutp/utp.cpp
@@ -1628,7 +1628,6 @@ void UTPSocket::apply_ledbat_ccontrol(size_t bytes_acked, uint32 actual_delay, i
int32 our_delay = min<uint32>(our_hist.get_value(), uint32(min_rtt));
assert(our_delay != INT_MAX);
assert(our_delay >= 0);
- assert(our_hist.get_value() >= 0);
SOCKADDR_STORAGE sa = addr.get_sockaddr_storage();
UTP_DelaySample((sockaddr*)&sa, our_delay / 1000);
@@ -1942,14 +1941,12 @@ size_t UTP_ProcessIncoming(UTPSocket *conn, const byte *packet, size_t len, bool
?(pf->reply_micro==INT_MAX?0:uint32(pf->reply_micro))
:(uint32(pf1->reply_micro)==INT_MAX?0:uint32(pf1->reply_micro));
- assert(conn->our_hist.get_value() >= 0);
// if the actual delay is 0, it means the other end
// hasn't received a sample from us yet, and doesn't
// know what it is. We can't update out history unless
// we have a true measured sample
prev_delay_base = conn->our_hist.delay_base;
if (actual_delay != 0) conn->our_hist.add_sample(actual_delay);
- assert(conn->our_hist.get_value() >= 0);
// if our new delay base is less than our previous one
// we should shift the other end's delay base in the other

0 comments on commit 8df6bd8

Please sign in to comment.