~ubuntu-branches/ubuntu/maverick/coherence/maverick

« back to all changes in this revision

Viewing changes to coherence/upnp/core/ssdp.py

  • Committer: Bazaar Package Importer
  • Author(s): Charlie Smotherman
  • Date: 2010-01-02 10:57:15 UTC
  • mfrom: (1.1.7 upstream) (3.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100102105715-sghzl2nw4lr5b1ob
Tags: 0.6.6.2-1
*  New  upstream release, summary of changes:
    - adding all necessary files to MANIFEST.in, to compensate for the
      gone 'auto-include-all-files-under-version-control' setuptools
      feature.
    - rearranging genre and genres attribute in DIDLLite - thx Caleb  
    - fix face_path typo, fixes #275.   

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
# Copyright 2005, Tim Potter <tpot@samba.org>
5
5
# Copyright 2006 John-Mark Gurney <gurney_j@resnet.uroegon.edu>
6
6
# Copyright (C) 2006 Fluendo, S.A. (www.fluendo.com).
7
 
# Copyright 2006,2007 Frank Scholz <coherence@beebits.net>
 
7
# Copyright 2006,2007,2008,2009 Frank Scholz <coherence@beebits.net>
8
8
#
9
9
# Implementation of a SSDP server under Twisted Python.
10
10
#
18
18
from twisted.internet.protocol import DatagramProtocol
19
19
from twisted.internet import reactor, error
20
20
from twisted.internet import task
 
21
from twisted.web.http import datetimeToString
21
22
 
22
23
from coherence import log, SERVER_ID
23
24
 
35
36
 
36
37
    _callbacks = {}
37
38
 
38
 
    def __init__(self,test=False):
 
39
    def __init__(self,test=False,interface=''):
39
40
        # Create SSDP server
40
41
        self.test = test
41
42
        if self.test == False:
43
44
                self.port = reactor.listenMulticast(SSDP_PORT, self, listenMultiple=True)
44
45
                #self.port.setLoopbackMode(1)
45
46
 
46
 
                self.port.joinGroup(SSDP_ADDR)
 
47
                self.port.joinGroup(SSDP_ADDR,interface=interface)
47
48
 
48
49
                self.resend_notify_loop = task.LoopingCall(self.resendNotify)
49
50
                self.resend_notify_loop.start(777.0, now=False)
203
204
                        usn = v
204
205
                    if k not in ('MANIFESTATION','SILENT','HOST'):
205
206
                        response.append('%s: %s' % (k, v))
206
 
                response.append('DATE: %s' % time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime()))
 
207
                response.append('DATE: %s' % datetimeToString())
207
208
 
208
209
                response.extend(('', ''))
209
210
                delay = random.randint(0, int(headers['mx']))