Changeset 139


Ignore:
Timestamp:
Mar 9, 2006, 2:02:34 AM (16 years ago)
Author:
titer
Message:

Seperates status and error in tr_stat_t.

Location:
branches/new_api
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/new_api/libtransmission/internal.h

    r137 r139  
    108108
    109109    int               status;
    110         int                               finished;
    111     char              error[128];
     110    int               error;
     111    char              trackerError[128];
     112    int               finished;
    112113
    113114    char            * id;
  • branches/new_api/libtransmission/tracker.c

    r137 r139  
    376376    {
    377377        tr_err( "Tracker: %s", bePeers->val.s.s );
    378         tor->status |= TR_TRACKER_ERROR;
    379         snprintf( tor->error, sizeof( tor->error ),
     378        tor->error |= TR_ETRACKER;
     379        snprintf( tor->trackerError, sizeof( tor->trackerError ),
    380380                  "%s", bePeers->val.s.s );
    381381        goto cleanup;
    382382    }
    383 
    384     tor->status &= ~TR_TRACKER_ERROR;
     383    tor->error &= ~TR_ETRACKER;
    385384
    386385    if( !tc->interval )
  • branches/new_api/libtransmission/transmission.c

    r138 r139  
    364364
    365365    s->status = tor->status;
    366     memcpy( s->error, tor->error, sizeof( s->error ) );
     366    memcpy( s->trackerError, tor->trackerError,
     367            sizeof( s->trackerError ) );
    367368
    368369    s->peersTotal       = 0;
     
    438439    s->downloaded = tor->downloaded;
    439440    s->uploaded   = tor->uploaded;
    440 
    441     s->folder = tor->destination;
    442441
    443442    tr_lockUnlock( &tor->lock );
  • branches/new_api/libtransmission/transmission.h

    r138 r139  
    3030#include <inttypes.h>
    3131
    32 #define SHA_DIGEST_LENGTH    20
     32#define SHA_DIGEST_LENGTH 20
    3333#ifdef __BEOS__
    3434# include <StorageDefs.h>
    35 # define MAX_PATH_LENGTH B_FILE_NAME_LENGTH
     35# define MAX_PATH_LENGTH  B_FILE_NAME_LENGTH
    3636#else
    37 # define MAX_PATH_LENGTH      1024
    38 #endif
    39 
    40 #define TR_DEFAULT_PORT      9090
     37# define MAX_PATH_LENGTH  1024
     38#endif
     39
     40#define TR_DEFAULT_PORT   9090
     41#define TR_NOERROR        0
    4142
    4243/***********************************************************************
     
    99100 * Opens and parses torrent file at 'path'. If the file exists and is a
    100101 * valid torrent file, returns an handle and adds it to the list of
    101  * torrents (but doesn't start it). Returns NULL and sets error
     102 * torrents (but doesn't start it). Returns NULL and sets *error
    102103 * otherwise.
    103104 **********************************************************************/
    104105typedef struct tr_torrent_s tr_torrent_t;
    105 #define TR_SUCCESS      0
    106106#define TR_EINVALID     1
    107107#define TR_EUNSUPPORTED 2
     
    177177void tr_torrentClose( tr_handle_t *, tr_torrent_t * );
    178178
    179 /***********************************************************************
    180  * tr_stat_s
     179
     180/***********************************************************************
     181 * tr_info_s
    181182 **********************************************************************/
    182183typedef struct tr_file_s
     
    186187}
    187188tr_file_t;
    188 
    189189struct tr_info_s
    190190{
     
    212212};
    213213
     214/***********************************************************************
     215 * tr_stat_s
     216 **********************************************************************/
    214217struct tr_stat_s
    215218{
     
    217220#define TR_STATUS_DOWNLOAD 0x002 /* Downloading */
    218221#define TR_STATUS_SEED     0x004 /* Seeding */
     222#define TR_STATUS_ACTIVE   0x007 /* CHECK | DOWNLOAD | SEED */
    219223#define TR_STATUS_STOPPING 0x008 /* Sending 'stopped' to the tracker */
    220224#define TR_STATUS_STOPPED  0x010 /* Sent 'stopped' but thread still
    221225                                    running (for internal use only) */
    222226#define TR_STATUS_PAUSE    0x020 /* Paused */
    223 #define TR_TRACKER_ERROR   0x100
     227#define TR_STATUS_INACTIVE 0x038 /* STOPPING | STOPPED | PAUSE */
    224228    int         status;
    225     char        error[128];
     229
     230#define TR_ETRACKER 1
     231#define TR_EINOUT   2
     232    int         error;
     233    char        trackerError[128];
    226234
    227235    float       progress;
     
    238246    uint64_t    downloaded;
    239247    uint64_t    uploaded;
    240 
    241     char      * folder;
    242248};
    243249
  • branches/new_api/transmissioncli.c

    r138 r139  
    198198        fprintf( stderr, "\r%s", string );
    199199
    200         if( s->status & TR_TRACKER_ERROR )
    201         {
    202             fprintf( stderr, "\n%s\n", s->error );
     200        if( s->error & TR_ETRACKER )
     201        {
     202            fprintf( stderr, "\n%s\n", s->trackerError );
    203203        }
    204204        else if( verboseLevel > 0 )
Note: See TracChangeset for help on using the changeset viewer.