Changeset 5911
- Timestamp:
- May 22, 2008, 11:11:21 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gtk/details.c
r5843 r5911 1214 1214 1215 1215 l = page->last_scrape_time_lb; 1216 t = torStat-> trackerStat.lastScrapeTime;1216 t = torStat->lastScrapeTime; 1217 1217 refresh_time_lb( l, t ); 1218 1218 1219 1219 l = page->last_scrape_response_lb; 1220 gtk_label_set_text( GTK_LABEL( l ), torStat-> trackerStat.scrapeResponse );1220 gtk_label_set_text( GTK_LABEL( l ), torStat->scrapeResponse ); 1221 1221 1222 1222 l = page->next_scrape_countdown_lb; 1223 t = torStat-> trackerStat.nextScrapeTime;1223 t = torStat->nextScrapeTime; 1224 1224 refresh_countdown_lb( l, t ); 1225 1225 1226 1226 l = page->last_announce_time_lb; 1227 t = torStat-> trackerStat.lastAnnounceTime;1227 t = torStat->lastAnnounceTime; 1228 1228 refresh_time_lb( l, t ); 1229 1229 1230 1230 l = page->last_announce_response_lb; 1231 gtk_label_set_text( GTK_LABEL( l ), torStat-> trackerStat.announceResponse );1231 gtk_label_set_text( GTK_LABEL( l ), torStat->announceResponse ); 1232 1232 1233 1233 l = page->next_announce_countdown_lb; 1234 t = torStat-> trackerStat.nextAnnounceTime;1234 t = torStat->nextAnnounceTime; 1235 1235 refresh_countdown_lb( l, t ); 1236 1236 1237 1237 l = page->manual_announce_countdown_lb; 1238 t = torStat-> trackerStat.nextManualAnnounceTime;1238 t = torStat->manualAnnounceTime; 1239 1239 refresh_countdown_lb( l, t ); 1240 1240 } -
trunk/libtransmission/rpc.c
r5908 r5911 167 167 const tr_stat * st = tr_torrentStat( tor ); 168 168 const int * f = st->peersFrom; 169 const struct tr_tracker_stat * s = &st->trackerStat; 170 tr_benc * d = tr_bencListAddDict( list, 35 ); 169 tr_benc * d = tr_bencListAddDict( list, 40 ); 171 170 tr_benc * t; 172 171 173 172 tr_bencDictAddInt( d, "activityDate", st->activityDate ); 173 tr_bencDictAddStr( d, "announceResponse", st->announceResponse ); 174 174 tr_bencDictAddStr( d, "announceURL", st->announceURL ); 175 175 tr_bencDictAddInt( d, "completedFromTracker", st->completedFromTracker ); … … 183 183 tr_bencDictAddInt( d, "haveValid", st->haveValid ); 184 184 tr_bencDictAddInt( d, "id", st->id ); 185 tr_bencDictAddInt( d, "lastAnnounceTime", st->lastAnnounceTime ); 186 tr_bencDictAddInt( d, "lastScrapeTime", st->lastScrapeTime ); 185 187 tr_bencDictAddInt( d, "leechers", st->leechers ); 186 188 tr_bencDictAddInt( d, "leftUntilDone", st->leftUntilDone ); 187 189 tr_bencDictAddInt( d, "manualAnnounceTime", st->manualAnnounceTime ); 190 tr_bencDictAddInt( d, "nextAnnounceTime", st->nextAnnounceTime ); 191 tr_bencDictAddInt( d, "nextScrapeTime", st->nextScrapeTime ); 188 192 tr_bencDictAddInt( d, "peersConnected", st->peersConnected ); 189 193 t = tr_bencDictAddDict( d, "peersFrom", 4 ); … … 201 205 tr_bencDictAddDouble( d, "ratio", st->ratio ); 202 206 tr_bencDictAddDouble( d, "recheckProgress", st->recheckProgress ); 207 tr_bencDictAddStr( d, "scrapeResponse", st->scrapeResponse ); 203 208 tr_bencDictAddStr( d, "scrapeURL", st->scrapeURL ); 204 209 tr_bencDictAddInt( d, "seeders", st->seeders ); … … 207 212 tr_bencDictAddInt( d, "status", st->status ); 208 213 tr_bencDictAddDouble( d, "swarmSpeed", st->swarmSpeed ); 209 t = tr_bencDictAddDict( d, "trackerStat", 7 );210 tr_bencDictAddStr( t, "announceResponse", s->announceResponse );211 tr_bencDictAddInt( t, "lastAnnounceTime", s->lastAnnounceTime );212 tr_bencDictAddInt( t, "lastScrapeTime", s->lastScrapeTime );213 tr_bencDictAddInt( t, "nextAnnounceTime", s->nextAnnounceTime );214 tr_bencDictAddInt( t, "nextScrapeTime", s->nextScrapeTime );215 tr_bencDictAddInt( t, "nextScrapeTime", s->nextScrapeTime );216 tr_bencDictAddStr( t, "scrapeResponse", s->scrapeResponse );217 214 tr_bencDictAddInt( d, "uploadedEver", st->uploadedEver ); 218 215 } -
trunk/libtransmission/session.h
r5900 r5911 107 107 int tr_globalIsLocked ( const tr_session * ); 108 108 109 110 #define TR_ERROR_IS_IO(e) (TR_ERROR_IO_PARENT<=(e) && (e)<=TR_ERROR_IO_OTHER) 111 #define TR_ERROR_IS_TC(e) (TR_ERROR_TC_ERROR<=(e) && (e)<=TR_ERROR_TC_WARNING) 112 113 109 114 #endif -
trunk/libtransmission/torrent.c
r5908 r5911 707 707 s->announceURL = ti ? ti->announce : NULL; 708 708 s->scrapeURL = ti ? ti->scrape : NULL; 709 tr_trackerStat( tc, &s->trackerStat);709 tr_trackerStat( tc, s ); 710 710 tr_trackerGetCounts( tc, &s->completedFromTracker, 711 711 &s->leechers, 712 712 &s->seeders ); 713 714 713 tr_peerMgrTorrentStats( tor->handle->peerMgr, 715 714 tor->info.hash, … … 719 718 &s->peersGettingFromUs, 720 719 s->peersFrom ); 721 722 s->manualAnnounceTime = tr_trackerGetManualAnnounceTime( tor->tracker );723 720 724 721 s->percentComplete = tr_cpPercentComplete ( tor->completion ); … … 914 911 } 915 912 916 void917 tr_torrentRemoveSaved( tr_torrent * tor )918 {919 tr_metainfoRemoveSaved( tor->handle, &tor->info );920 921 tr_torrentRemoveResume( tor );922 }923 924 913 /*** 925 914 **** … … 1114 1103 tor->isRunning = 0; 1115 1104 stopTorrent( tor ); 1116 if( tor->isDeleting ) 1117 tr_torrentRemoveSaved( tor ); 1105 if( tor->isDeleting ) { 1106 tr_metainfoRemoveSaved( tor->handle, &tor->info ); 1107 tr_torrentRemoveResume( tor ); 1108 } 1118 1109 freeTorrent( tor ); 1119 1110 } -
trunk/libtransmission/tracker.c
r5859 r5911 987 987 988 988 void 989 tr_trackerStat( const tr_tracker 990 struct tr_ tracker_stat* setme)989 tr_trackerStat( const tr_tracker * t, 990 struct tr_stat * setme) 991 991 { 992 992 assert( t ); … … 997 997 setme->lastAnnounceTime = t->lastAnnounceTime; 998 998 setme->nextAnnounceTime = t->reannounceAt; 999 setme-> nextManualAnnounceTime = t->manualAnnounceAllowedAt;999 setme->manualAnnounceTime = t->manualAnnounceAllowedAt; 1000 1000 1001 1001 if( t->lastScrapeResponse == -1 ) /* never been scraped */ -
trunk/libtransmission/tracker.h
r5647 r5911 73 73 74 74 void tr_trackerStat ( const tr_tracker * tracker, 75 struct tr_ tracker_stat* setme);75 struct tr_stat * setme); 76 76 77 77 void tr_trackerStart ( struct tr_tracker * ); -
trunk/libtransmission/transmission.h
r5908 r5911 89 89 * "resume", and "blocklists". 90 90 * TR_DEFAULT_CONFIG_DIR can be used as a default. 91 * @param downloadDir the default directory to save torrents that are added. 92 * This can be changed per-session with tr_sessionSetDownloadDir() 93 * and per-torrent with tr_ctorSetDownloadDir(). 94 * @param tag currently only used for locating legacy versions of 95 * fastresume files. valid tags: beos, cli, daemon, gtk, macos, wx 91 * @param downloadDir The default directory to save added torrents. 92 * This can be changed per-session with 93 * tr_sessionSetDownloadDir() and per-torrent with 94 * tr_ctorSetDownloadDir(). 95 * @param tag Obsolete. Only used now for locating legacy fastresume files. 96 * Valid tags: beos, cli, daemon, gtk, macos, wx 96 97 * @param isPexEnabled whether or not PEX is allowed for non-private torrents. 97 * This can be changed per-session with tr_sessionSetPexEnabled(). 98 * TR_DEFAULT_PEX_ENABLED can be used as a default. 99 * @param isPortForwardingEnabled If true, libtransmission will attempt to find a local 100 * UPnP-enabled or NATPMP-enabled router and forward a 101 * port from there to the local machine. This is so that 102 * remote peers can initiate connections with us. 103 * TR_DEFAULT_PORT_FORWARDING_ENABLED can be used as a default. 104 * @param publicPort Port number to open for listening to incoming peer connections. 105 * TR_DEFAULT_PORT can be used as a default. 98 * This can be changed per-session with 99 * tr_sessionSetPexEnabled(). 100 * TR_DEFAULT_PEX_ENABLED is the default. 101 * @param isPortForwardingEnabled If true, libtransmission will attempt 102 * to find a local UPnP-enabled or NATPMP-enabled 103 * router and forward a port from there to the local 104 * machine. This is so remote peers can initiate 105 * connections with us. 106 * TR_DEFAULT_PORT_FORWARDING_ENABLED is the default. 107 * @param publicPort Port number to open for incoming peer connections. 108 * TR_DEFAULT_PORT is the default. 106 109 * @param encryptionMode must be one of TR_PLAINTEXT_PREFERRED, 107 110 * TR_ENCRYPTION_PREFERRED, or TR_ENCRYPTION_REQUIRED. 108 111 * @param isUploadLimitEnabled If true, libtransmission will limit the entire 109 * session's upload speed based on`uploadLimit'.112 * session's upload speed from `uploadLimit'. 110 113 * @param uploadLimit The speed limit to use for the entire session when 111 114 * isUploadLimitEnabled is true. 112 115 * @param isDownloadLimitEnabled If true, libtransmission will limit the entire 113 * session's download speed based on`downloadLimit'.116 * session's download speed from `downloadLimit'. 114 117 * @param downloadLimit The speed limit to use for the entire session when 115 118 * isDownloadLimitEnabled is true. … … 156 159 157 160 /** 158 * Set the per-session default download folder for torrents that haven't been added yet. 161 * Returns the configuration directory passed into tr_sessionInitFull(). 162 * This is where transmission stores its .torrent files, .resume files, 163 * blocklists, etc. 164 */ 165 const char * tr_sessionGetConfigDir( const tr_handle * ); 166 167 /** 168 * Set the per-session default download folder for new torrents. 159 169 * @see tr_sessionInitFull() 160 170 * @see tr_ctorSetDownloadDir() … … 174 184 /** 175 185 * Specify access control list (ACL). ACL is a comma separated list 176 * of IP subnets, each subnet is prepended by â-â or â+â sign. Plus177 * means allow, minus means deny. If subnet mask is omitted, like178 * "-1.2.3.4", then it means single IP address. Mask may vary from 0179 * to 32 inclusive.186 * of IP subnets, each subnet is prepended by a '-' or '+' sign. 187 * Plus means allow, minus means deny. If the subnet mask is omitted, 188 * like * "-1.2.3.4", it means a single IP address. The mask may vary 189 * from 0 to 32 inclusive. 180 190 * 181 191 * The default string is "+127.0.0.1" … … 259 269 void tr_sessionSetEncryption( tr_handle * handle, tr_encryption_mode mode ); 260 270 261 /***********************************************************************262 * tr_getPrefsDirectory263 ***********************************************************************264 * Returns the full path to a directory which can be used to store265 * preferences. The string belongs to libtransmission, do not free it.266 **********************************************************************/267 const char * tr_sessionGetConfigDir( const tr_handle * );268 269 271 270 272 /*********************************************************************** … … 486 488 typedef int8_t tr_priority_t; 487 489 488 /* set a batch of files to a particular priority. 489 * priority must be one of TR_PRI_NORMAL, _HIGH, or _LOW */ 490 /** 491 * Set a batch of files to a particular priority. 492 * Priority must be one of TR_PRI_NORMAL, _HIGH, or _LOW 493 */ 490 494 void tr_torrentSetFilePriorities( tr_torrent * tor, 491 495 tr_file_index_t * files, … … 493 497 tr_priority_t priority ); 494 498 495 /* returns a malloc()ed array of tor->info.fileCount items, 496 * each holding a value of TR_PRI_NORMAL, _HIGH, or _LOW. 497 free the array when done. */ 499 /** 500 * Get this torrent's file priorities. 501 * 502 * @return A malloc()ed array of tor->info.fileCount items, 503 * each holding a value of TR_PRI_NORMAL, _HIGH, or _LOW. 504 * The caller must free() the array when done. 505 */ 498 506 tr_priority_t* tr_torrentGetFilePriorities( const tr_torrent * ); 499 507 500 /* single-file form of tr_torrentGetFilePriorities. 501 * returns one of TR_PRI_NORMAL, _HIGH, or _LOW. */ 502 tr_priority_t tr_torrentGetFilePriority( const tr_torrent *, tr_file_index_t file ); 503 504 /* returns true if the file's `download' flag is set */ 508 /** 509 * Single-file form of tr_torrentGetFilePriorities. 510 * returns one of TR_PRI_NORMAL, _HIGH, or _LOW. 511 */ 512 tr_priority_t tr_torrentGetFilePriority( const tr_torrent *, 513 tr_file_index_t file ); 514 515 /** 516 * Returns true if the file's `download' flag is set. 517 */ 505 518 int tr_torrentGetFileDL( const tr_torrent *, tr_file_index_t file ); 506 519 507 /* set a batch of files to be downloaded or not. */ 520 /** 521 * Set a batch of files to be downloaded or not. 522 */ 508 523 void tr_torrentSetFileDLs ( tr_torrent * tor, 509 524 tr_file_index_t * files, … … 774 789 void tr_torrentAmountFinished( const tr_torrent * tor, float * tab, int size ); 775 790 776 /***********************************************************************777 * tr_torrentRemoveSaved778 ***********************************************************************779 * delete's Transmission's copy of the torrent's metadata from780 * tr_getTorrentDir().781 **********************************************************************/782 void tr_torrentRemoveSaved( tr_torrent * );783 784 791 void tr_torrentVerify( tr_torrent * ); 785 792 … … 905 912 tr_errno; 906 913 907 #define TR_ERROR_IS_IO(e) (TR_ERROR_IO_PARENT<=(e) && (e)<=TR_ERROR_IO_OTHER)908 #define TR_ERROR_IS_TC(e) (TR_ERROR_TC_ERROR<=(e) && (e)<=TR_ERROR_TC_WARNING)909 910 struct tr_tracker_stat911 {912 /* This is the unmodified string returned by the tracker in response913 * to the torrent's most recent scrape request. If no request was914 * sent or there was no response, this string is empty. */915 char scrapeResponse[256];916 917 /* The unmodified string returned by the tracker in response918 * to the torrent's most recent scrape request. If no request was919 * sent or there was no response, this string is empty. */920 char announceResponse[256];921 922 /* Time the most recent scrape request was sent,923 * or zero if one hasn't been sent yet. */924 time_t lastScrapeTime;925 926 /* Time when the next scrape request will be sent.927 * This value is always a valid time. */928 time_t nextScrapeTime;929 930 /* Time the most recent announce request was sent,931 * or zero if one hasn't been sent yet. */932 time_t lastAnnounceTime;933 934 /* Time when the next reannounce request will be sent,935 * or zero if the torrent is stopped. */936 time_t nextAnnounceTime;937 938 /* When the tracker will allow a human-driven "manual" announce to be sent,939 * derived from the "min interval" field given by the tracker.940 * This value is 0 when the torrent is stopped.941 * This value is ~(time_t)0 if the tracker returned a serious error.942 * Otherwise, the value is a valid time.943 * @see tr_torrentManualUpdate( tr_torrent * );944 * @see tr_torrentCanManualUpdate( const tr_torrent * ); */945 time_t nextManualAnnounceTime;946 };947 948 914 tr_torrent_status tr_torrentGetStatus( tr_torrent * ); 949 915 … … 962 928 963 929 tr_torrent_status status; 964 965 struct tr_tracker_stat trackerStat;966 930 967 931 char * announceURL; … … 1000 964 int completedFromTracker; 1001 965 966 /* Byte count of all the piece data we'll have downloaded when we're done. 967 * whether or not we have it yet. [0...tr_info.totalSize] */ 968 uint64_t sizeWhenDone; 969 970 /* Byte count of how much data is left to be downloaded until 971 * we're done -- that is, until we've got all the pieces we wanted. 972 * [0...tr_info.sizeWhenDone] */ 973 uint64_t leftUntilDone; 974 975 /* Byte count of all the piece data we want and don't have yet, 976 * but that a connected peer does have. [0...leftUntilDone] */ 977 uint64_t desiredAvailable; 978 979 /* Byte count of all the corrupt data you've ever downloaded for 980 * this torrent. If you're on a poisoned torrent, this number can 981 * grow very large. */ 982 uint64_t corruptEver; 983 984 /* Byte count of all data you've ever uploaded for this torrent. */ 985 uint64_t uploadedEver; 986 987 /* Byte count of all the non-corrupt data you've ever downloaded 988 * for this torrent. If you deleted the files and downloaded a second time, 989 * this will be 2*totalSize.. */ 990 uint64_t downloadedEver; 991 992 /* Byte count of all the checksum-verified data we have for this torrent. */ 993 uint64_t haveValid; 994 995 /* Byte count of all the partial piece data we have for this torrent. 996 * As pieces become complete, this value may decrease as portions of it are 997 * moved to `corrupt' or `haveValid'. */ 998 uint64_t haveUnchecked; 999 1000 /* This is the unmodified string returned by the tracker in response 1001 * to the torrent's most recent scrape request. If no request was 1002 * sent or there was no response, this string is empty. */ 1003 char scrapeResponse[256]; 1004 1005 /* The unmodified string returned by the tracker in response 1006 * to the torrent's most recent scrape request. If no request was 1007 * sent or there was no response, this string is empty. */ 1008 char announceResponse[256]; 1009 1010 /* Time the most recent scrape request was sent, 1011 * or zero if one hasn't been sent yet. */ 1012 time_t lastScrapeTime; 1013 1014 /* Time when the next scrape request will be sent. 1015 * This value is always a valid time. */ 1016 time_t nextScrapeTime; 1017 1018 /* Time the most recent announce request was sent, 1019 * or zero if one hasn't been sent yet. */ 1020 time_t lastAnnounceTime; 1021 1022 /* Time when the next reannounce request will be sent, 1023 * or zero if the torrent is stopped. */ 1024 time_t nextAnnounceTime; 1025 1002 1026 /* if the torrent is running, this is the time at which 1003 1027 * the client can manually ask the torrent's tracker 1004 1028 * for more peers. otherwise, the value is zero. */ 1005 1029 time_t manualAnnounceTime; 1006 1007 /* Byte count of all the piece data we'll have downloaded when we're done.1008 * whether or not we have it yet. [0...tr_info.totalSize] */1009 uint64_t sizeWhenDone;1010 1011 /* Byte count of how much data is left to be downloaded until1012 * we're done -- that is, until we've got all the pieces we wanted.1013 * [0...tr_info.sizeWhenDone] */1014 uint64_t leftUntilDone;1015 1016 /* Byte count of all the piece data we want and don't have yet,1017 * but that a connected peer does have. [0...leftUntilDone] */1018 uint64_t desiredAvailable;1019 1020 /* Byte count of all the corrupt data you've ever downloaded for1021 * this torrent. If you're on a poisoned torrent, this number can1022 * grow very large. */1023 uint64_t corruptEver;1024 1025 /* Byte count of all data you've ever uploaded for this torrent. */1026 uint64_t uploadedEver;1027 1028 /* Byte count of all the non-corrupt data you've ever downloaded1029 * for this torrent. If you deleted the files and downloaded a second time,1030 * this will be 2*totalSize.. */1031 uint64_t downloadedEver;1032 1033 /* Byte count of all the checksum-verified data we have for this torrent. */1034 uint64_t haveValid;1035 1036 /* Byte count of all the partial piece data we have for this torrent.1037 * As pieces become complete, this value may decrease as portions of it are1038 * moved to `corrupt' or `haveValid'. */1039 uint64_t haveUnchecked;1040 1030 1041 1031 float swarmSpeed; -
trunk/macosx/Torrent.m
r5910 r5911 729 729 - (NSDate *) lastAnnounceTime 730 730 { 731 int date = fStat-> trackerStat.lastAnnounceTime;731 int date = fStat->lastAnnounceTime; 732 732 return date > 0 ? [NSDate dateWithTimeIntervalSince1970: date] : nil; 733 733 } … … 735 735 - (int) nextAnnounceTime 736 736 { 737 int date = fStat-> trackerStat.nextAnnounceTime;737 int date = fStat->nextAnnounceTime; 738 738 if (date <= 0) 739 739 return -1; … … 745 745 - (NSString *) announceResponse 746 746 { 747 return [NSString stringWithUTF8String: fStat-> trackerStat.announceResponse];747 return [NSString stringWithUTF8String: fStat->announceResponse]; 748 748 } 749 749 … … 755 755 - (NSDate *) lastScrapeTime 756 756 { 757 int date = fStat-> trackerStat.lastScrapeTime;757 int date = fStat->lastScrapeTime; 758 758 return date > 0 ? [NSDate dateWithTimeIntervalSince1970: date] : nil; 759 759 } … … 761 761 - (int) nextScrapeTime 762 762 { 763 int date = fStat-> trackerStat.nextScrapeTime;763 int date = fStat->nextScrapeTime; 764 764 if (date <= 0) 765 765 return -1; … … 771 771 - (NSString *) scrapeResponse 772 772 { 773 return [NSString stringWithUTF8String: fStat-> trackerStat.scrapeResponse];773 return [NSString stringWithUTF8String: fStat->scrapeResponse]; 774 774 } 775 775
Note: See TracChangeset
for help on using the changeset viewer.