mirror of
https://github.com/transmission/transmission
synced 2025-03-10 06:02:57 +00:00
Fix for when the returned client string is "unknown client ("
This commit is contained in:
parent
1c7d77b501
commit
402e827a87
2 changed files with 8 additions and 2 deletions
|
@ -87,7 +87,7 @@ char * tr_clientForId( uint8_t * id )
|
||||||
|
|
||||||
if( !ret )
|
if( !ret )
|
||||||
{
|
{
|
||||||
asprintf( &ret, "Unknown client (%c%c%c%c%c%c%c%c)",
|
asprintf( &ret, "unknown client (%c%c%c%c%c%c%c%c)",
|
||||||
id[0], id[1], id[2], id[3], id[4], id[5], id[6], id[7] );
|
id[0], id[1], id[2], id[3], id[4], id[5], id[6], id[7] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -523,12 +523,18 @@
|
||||||
tr_peer_stat_t peer;
|
tr_peer_stat_t peer;
|
||||||
|
|
||||||
NSMutableArray * peerDics = [NSMutableArray arrayWithCapacity: totalPeers];
|
NSMutableArray * peerDics = [NSMutableArray arrayWithCapacity: totalPeers];
|
||||||
|
NSString * client;
|
||||||
for (i = 0; i < totalPeers; i++)
|
for (i = 0; i < totalPeers; i++)
|
||||||
{
|
{
|
||||||
peer = peers[i];
|
peer = peers[i];
|
||||||
|
|
||||||
|
client = [NSString stringWithCString: (char *) peer.client encoding: NSUTF8StringEncoding];
|
||||||
|
//get rid of strange returned client strings
|
||||||
|
if ([client hasPrefix: @"unknown client ("] && ![client hasSuffix: @")"])
|
||||||
|
client = @"unknown client";
|
||||||
|
|
||||||
[peerDics addObject: [NSDictionary dictionaryWithObjectsAndKeys:
|
[peerDics addObject: [NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
[NSString stringWithCString: (char *) peer.client encoding: NSUTF8StringEncoding], @"Client",
|
client, @"Client",
|
||||||
[NSNumber numberWithBool: peer.isDownloading], @"UL To",
|
[NSNumber numberWithBool: peer.isDownloading], @"UL To",
|
||||||
[NSNumber numberWithBool: peer.isUploading], @"DL From", nil]];
|
[NSNumber numberWithBool: peer.isUploading], @"DL From", nil]];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue