~ubuntu-branches/ubuntu/natty/transmission/natty

« back to all changes in this revision

Viewing changes to libtransmission/port-forwarding.c

  • Committer: Bazaar Package Importer
  • Author(s): Krzysztof Klimonda
  • Date: 2009-12-08 10:49:11 UTC
  • mfrom: (1.1.29 upstream) (2.1.10 sid)
  • Revision ID: james.westby@ubuntu.com-20091208104911-06gio45n2nla3vpg
Tags: 1.80~b1-0ubuntu1
* New upstream release (LP: #460620), rebased on debian unstable
  remaining changes:
  - debian/control:
    + Added replaces & provides clutch (now included as part of transmission).
      Can be removed in lucid+1
    + Added quilt, liblaunchpad-integration-dev and lsb-release to Build-Depends
  - debian/rules:
    + create a po template during package build.
  - 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.
  - debian/transmission-daemon.default:
    - remove --auth from OPTIONS
* Fixes bugs:
  - tray menu shows wrong status for "main window" when started minimized
    (LP: #451415)
* Refreshed patches:
  - dont_build_libevent.patch
  - 99_autoreconf.patch
* Removed patches:
  - 21_onPortTested.diff, 23_tr_torrentNext.diff and
    24_tr_torrentDeleteLocalData_do_move.diff
* debian/patches/21_fix_inhibition.patch:
  - The right value for suspend inhibition is 4
* debian/control:
  - Build-Depend on libgconf2-dev to enable magnet link registration and on
    libcanberra-gtk-dev for notification sound.
* debian/watch:
  - make it detect beta versions, to be removed after 1.80 is released.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * This file Copyright (C) 2008-2009 Charles Kerr <charles@transmissionbt.com>
 
2
 * This file Copyright (C) 2008-2009 Mnemosyne LLC
3
3
 *
4
4
 * This file is licensed by the GPL version 2.  Works owned by the
5
5
 * Transmission project are granted a special exemption to clause 2(b)
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 8767 2009-07-01 14:58:57Z charles $
 
10
 * $Id: port-forwarding.c 9671 2009-12-05 02:19:24Z charles $
11
11
 */
12
12
 
13
13
#include <errno.h>
89
89
}
90
90
 
91
91
static void
92
 
onTimer( int fd UNUSED, short what UNUSED, void * vshared )
 
92
set_evtimer_from_status( tr_shared * s )
93
93
{
94
94
    int sec=0, msec=0;
95
 
    tr_shared * s = vshared;
96
 
 
97
 
    assert( s );
98
 
    assert( s->timer );
99
 
 
100
 
    /* do something */
101
 
    natPulse( s, s->doPortCheck );
102
 
    s->doPortCheck = FALSE;
103
95
 
104
96
    /* when to wake up again */
105
97
    switch( tr_sharedTraversalStatus( s ) )
122
114
            break;
123
115
    }
124
116
 
125
 
    tr_timerAdd( s->timer, sec, msec );
 
117
    if( s->timer != NULL )
 
118
        tr_timerAdd( s->timer, sec, msec );
 
119
}
 
120
 
 
121
static void
 
122
onTimer( int fd UNUSED, short what UNUSED, void * vshared )
 
123
{
 
124
    tr_shared * s = vshared;
 
125
 
 
126
    assert( s );
 
127
    assert( s->timer );
 
128
 
 
129
    /* do something */
 
130
    natPulse( s, s->doPortCheck );
 
131
    s->doPortCheck = FALSE;
 
132
 
 
133
    /* set up the timer for the next pulse */
 
134
    set_evtimer_from_status( s );
126
135
}
127
136
 
128
137
/***
130
139
***/
131
140
 
132
141
tr_shared *
133
 
tr_sharedInit( tr_session  * session, tr_bool isEnabled )
 
142
tr_sharedInit( tr_session  * session )
134
143
{
135
144
    tr_shared * s = tr_new0( tr_shared, 1 );
136
145
 
137
146
    s->session      = session;
138
 
    s->isEnabled    = isEnabled;
 
147
    s->isEnabled    = FALSE;
139
148
    s->upnpStatus   = TR_PORT_UNMAPPED;
140
149
    s->natpmpStatus = TR_PORT_UNMAPPED;
141
150
 
 
151
#if 0
142
152
    if( isEnabled )
143
153
    {
144
154
        s->timer = tr_new0( struct event, 1 );
145
155
        evtimer_set( s->timer, onTimer, s );
146
156
        tr_timerAdd( s->timer, 0, 333000 );
147
157
    }
 
158
#endif
148
159
 
149
160
    return s;
150
161
}
188
199
{
189
200
    s->timer = tr_new0( struct event, 1 );
190
201
    evtimer_set( s->timer, onTimer, s );
191
 
    onTimer( 0, 0, s );
 
202
    set_evtimer_from_status( s );
192
203
}
193
204
 
194
205
void