Changeset 920 for trunk/gtk/main.c


Ignore:
Timestamp:
Sep 25, 2006, 6:37:45 PM (15 years ago)
Author:
joshe
Message:

Merge nat-traversal branch to trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/main.c

    r918 r920  
    178178  TrBackend *back;
    179179  benc_val_t *state;
    180   const char *pref;
    181   long intval;
    182180  GList *argfiles;
    183181  gboolean didinit, didlock;
     
    234232      back = tr_backend_new();
    235233
    236       /* set the upload limit */
    237       setlimit(back);
    238 
    239       /* set the listening port */
    240       if(NULL != (pref = cf_getpref(PREF_PORT)) &&
    241          0 < (intval = strtol(pref, NULL, 10)) && 0xffff >= intval)
    242         tr_setBindPort(tr_backend_handle(back), intval);
     234      /* apply a few prefs */
     235      applyprefs(back);
    243236
    244237      makewind(mainwind, back, state, argfiles);
     
    524517  tr_backend_stop_torrents(data->back);
    525518
     519  /* shut down nat traversal */
     520  tr_natTraversalDisable(tr_backend_handle(data->back));
     521
    526522  /* set things up to wait for torrents to stop */
    527523  edata = g_new0(struct exitdata, 1);
     
    545541exitcheck(gpointer gdata) {
    546542  struct exitdata *data = gdata;
    547 
    548   /* keep going if we still have torrents and haven't hit the exit timeout */
    549   if(time(NULL) - data->started < TRACKER_EXIT_TIMEOUT &&
    550      !tr_backend_torrents_stopped(data->cbdata->back)) {
     543  int natstat = tr_natTraversalStatus(tr_backend_handle(data->cbdata->back));
     544
     545  /* keep going if we haven't hit the exit timeout and
     546     we either have torrents left or nat traversal is stopping */
     547  if( time( NULL ) - data->started < TRACKER_EXIT_TIMEOUT &&
     548      ( !tr_backend_torrents_stopped( data->cbdata->back ) &&
     549        TR_NAT_TRAVERSAL_DISABLED != natstat ) ) {
    551550    updatemodel(data->cbdata);
    552551    return TRUE;
Note: See TracChangeset for help on using the changeset viewer.