~ubuntu-branches/ubuntu/lucid/transmission/lucid

« back to all changes in this revision

Viewing changes to libtransmission/port-forwarding.c

  • Committer: Bazaar Package Importer
  • Author(s): Krzysztof Klimonda
  • Date: 2009-06-16 02:41:48 UTC
  • mfrom: (1.1.25 upstream) (2.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090616024148-kap504e2oaerwcah
Tags: 1.72-1ubuntu1
* Merge from debian unstable (LP: #388377), remaining changes:
  - debian/control:
    + Added replaces & provides clutch (now included as part of transmission).
    + add quilt, liblaunchpad-integration and libtool to Build-Depends
  - debian/rules:
    + Create a PO template during package build.
    + re-enable quilt
    + run autoreconf for launchpad-integration
  - debian/patches/01_lpi.patch:
    + Integrate Transmission with Launchpad
  - debian/patches/20_add_X-Ubuntu-Gettext-Domain.diff:
    + Add X-Ubuntu-Gettext-Domain to .desktop file.
* Closes Launchpad bugs:
  - Use tooltip to notify user of added torrent (LP: #217171)
  - Transmission forgets torrent when adding several (LP: #259123)
  - Unable to sort files in torrent by Progress, Download nor Priority.
    (LP: #300359)
  - "Revert" and "Remove" uses same alt-key in Torrent Tracker Details
    (LP: #311064)
  - transmission crashed with SIGSEGV in g_closure_invoke() (LP: #334104)
  - Bring transmission to the top when adding a torrent (LP: #353777)
  - Focus should not be on "Don't ask me again" when I quit Transmission
    (LP: #359268)
  - [karmic] removing download items makes property window useless
    (LP: #385334)
  - transmission doesn't remember maximized state (LP: #385982)
  - Transmission 1.71 (8646) crashes when changing download speed
    (LP: #386877)
  - transmission: event.c:875: timeout_next: Assertion `tv->tv_usec >= 0'
    failed. (LP: #387564)

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 * This exemption does not extend to derived works not owned by
8
8
 * the Transmission project.
9
9
 *
10
 
 * $Id: port-forwarding.c 8538 2009-05-26 20:52:08Z charles $
 
10
 * $Id: port-forwarding.c 8698 2009-06-15 03:24:40Z charles $
11
11
 */
12
12
 
13
13
#include <errno.h>
91
91
static void
92
92
onTimer( int fd UNUSED, short what UNUSED, void * vshared )
93
93
{
 
94
    int sec=0, msec=0;
94
95
    tr_shared * s = vshared;
95
 
    struct timeval interval;
96
96
 
97
97
    assert( s );
98
98
    assert( s->timer );
108
108
            /* if we're mapped, everything is fine... check back in 20 minutes
109
109
             * to renew the port forwarding if it's expired */
110
110
            s->doPortCheck = TRUE;
111
 
            interval.tv_sec = 60*20;
 
111
            sec = 60 * 20;
112
112
            break;
113
113
 
114
114
        case TR_PORT_ERROR:
115
115
            /* some kind of an error.  wait 60 seconds and retry */
116
 
            interval.tv_sec = 60;
 
116
            sec = 60;
117
117
            break;
118
118
 
119
119
        default:
120
120
            /* in progress.  pulse frequently. */
121
 
            interval.tv_sec = 0;
122
 
            interval.tv_usec = 333000;
 
121
            msec = 333000;
123
122
            break;
124
123
    }
125
124
 
126
 
    evtimer_add( s->timer, &interval );
 
125
    tr_timerAdd( s->timer, sec, msec );
127
126
}
128
127
 
129
128
/***
142
141
 
143
142
    if( isEnabled )
144
143
    {
145
 
        struct timeval timeval;
146
 
        timeval.tv_sec = 0;
147
 
        timeval.tv_usec = 333000;
148
144
        s->timer = tr_new0( struct event, 1 );
149
145
        evtimer_set( s->timer, onTimer, s );
150
 
        evtimer_add( s->timer, &timeval );
 
146
        tr_timerAdd( s->timer, 0, 333000 );
151
147
    }
152
148
 
153
149
    return s;