Changeset 1463 for trunk/libtransmission/natpmp.c
- Timestamp:
- Feb 6, 2007, 5:37:48 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/natpmp.c
r1460 r1463 83 83 int newport; 84 84 int mappedport; 85 tr_lock_t lock;86 85 uint64_t renew; 87 86 tr_natpmp_req_t * req; … … 150 149 } 151 150 152 tr_lockInit( &pmp->lock );153 154 151 return pmp; 155 152 } … … 158 155 tr_natpmpStart( tr_natpmp_t * pmp ) 159 156 { 160 tr_lockLock( &pmp->lock );161 162 157 if( !pmp->active ) 163 158 { … … 169 164 } 170 165 } 171 172 tr_lockUnlock( &pmp->lock );173 166 } 174 167 … … 176 169 tr_natpmpStop( tr_natpmp_t * pmp ) 177 170 { 178 tr_lockLock( &pmp->lock );179 180 171 if( pmp->active ) 181 172 { … … 213 204 } 214 205 } 215 216 tr_lockUnlock( &pmp->lock );217 206 } 218 207 … … 221 210 { 222 211 int ret; 223 224 tr_lockLock( &pmp->lock );225 226 212 227 213 if( !pmp->active ) … … 260 246 } 261 247 262 tr_lockUnlock( &pmp->lock );263 264 248 return ret; 265 249 } … … 268 252 tr_natpmpForwardPort( tr_natpmp_t * pmp, int port ) 269 253 { 270 tr_lockLock( &pmp->lock );271 254 tr_inf( "nat-pmp set port %i", port ); 272 255 pmp->newport = port; 273 tr_lockUnlock( &pmp->lock );274 256 } 275 257 … … 281 263 tr_natpmpPulse( pmp, NULL ); 282 264 283 tr_lockLock( &pmp->lock );284 265 killreq( &pmp->req ); 285 tr_lockClose( &pmp->lock );286 266 free( pmp ); 287 267 } … … 290 270 tr_natpmpPulse( tr_natpmp_t * pmp, int * publicPort ) 291 271 { 292 tr_lockLock( &pmp->lock );293 294 272 if( 0 <= pmp->mcastfd ) 295 273 { … … 461 439 *publicPort = -1; 462 440 } 463 464 tr_lockUnlock( &pmp->lock );465 441 } 466 442
Note: See TracChangeset
for help on using the changeset viewer.