~ubuntu-branches/ubuntu/maverick/transmission/maverick-updates

« back to all changes in this revision

Viewing changes to macosx/PortChecker.m

  • 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
 
 * $Id: PortChecker.m 7659 2009-01-10 23:37:37Z livings124 $
 
2
 * $Id: PortChecker.m 9493 2009-11-08 06:01:29Z livings124 $
3
3
 *
4
4
 * Copyright (c) 2006-2009 Transmission authors and contributors
5
5
 *
24
24
 
25
25
#import "PortChecker.h"
26
26
 
27
 
#define CHECKER_URL @"http://portcheck.transmissionbt.com/%d"
 
27
#define CHECKER_URL(port) [NSString stringWithFormat: @"http://portcheck.transmissionbt.com/%d", port]
28
28
#define CHECK_FIRE  3.0
29
29
 
30
30
@interface PortChecker (Private)
31
31
 
32
 
- (void) startProbe;
 
32
- (void) startProbe: (NSTimer *) timer;
33
33
 
34
34
- (void) callBackWithStatus: (port_status_t) status;
35
35
 
43
43
    {
44
44
        fDelegate = delegate;
45
45
        
46
 
        fPortNumber = portNumber;
47
46
        fStatus = PORT_STATUS_CHECKING;
48
47
        
49
 
        if (delay)
50
 
            fTimer = [NSTimer scheduledTimerWithTimeInterval: CHECK_FIRE target: self
51
 
                        selector: @selector(startProbe) userInfo: nil repeats: NO];
52
 
        else
53
 
            [self startProbe];
 
48
        fTimer = [NSTimer scheduledTimerWithTimeInterval: CHECK_FIRE target: self selector: @selector(startProbe:)
 
49
                    userInfo: [NSNumber numberWithInteger: portNumber] repeats: NO];
 
50
        if (!delay)
 
51
            [fTimer fire];
54
52
    }
55
53
    
56
54
    return self;
108
106
            [self callBackWithStatus: PORT_STATUS_CLOSED];
109
107
        else
110
108
        {
111
 
            NSLog([NSString stringWithFormat: @"Unable to get port status: invalid response (%@)", probeString]);
 
109
            NSLog(@"Unable to get port status: invalid response (%@)", probeString);
112
110
            [self callBackWithStatus: PORT_STATUS_ERROR];
113
111
        }
114
112
        [probeString release];
124
122
 
125
123
@implementation PortChecker (Private)
126
124
 
127
 
- (void) startProbe
 
125
- (void) startProbe: (NSTimer *) timer
128
126
{
129
127
    fTimer = nil;
130
128
    
131
 
    NSURLRequest * portProbeRequest = [NSURLRequest requestWithURL: [NSURL URLWithString:
132
 
                                        [NSString stringWithFormat: CHECKER_URL, fPortNumber]]
 
129
    NSURLRequest * portProbeRequest = [NSURLRequest requestWithURL: [NSURL URLWithString: CHECKER_URL([[timer userInfo] integerValue])]
133
130
                                        cachePolicy: NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval: 15.0];
134
131
    
135
132
    if ((fConnection = [[NSURLConnection alloc] initWithRequest: portProbeRequest delegate: self]))