Logo Search packages:      
Sourcecode: hellanzb version File versions  Download package

def Hellanzb::Daemon::continueCurrent (  ) 

Continue an already paused download 

Definition at line 438 of file Daemon.py.

00438                      :
    """ Continue an already paused download """
    if not Hellanzb.downloadPaused:
        return True

    resetConnections = 0
    for nsf in Hellanzb.nsfs:
        connectionCount = nsf.connectionCount
        for client in nsf.clients:

            # When we pause a download, we simply stop reading from the socket. That
            # causes the connection to become lost fairly quickly. When that happens a new
            # client is created with the flag pauseReconnected=True. This new client acts
            # normally (anti idles the connection, etc) except it does not enter the
            # fetchNextNZBSegment loop. Thus when we encounter these clients we simply
            # tell them to begin downloading
            if client.pauseReconnected:
                debug(str(client) + ' pauseReconnect')
                client.pauseReconnected = False
                reactor.callLater(0, client.fetchNextNZBSegment)
            else:
                # Otherwise this was a short pause, the connection hasn't been lost, and
                # we can simply continue reading from the socket
                debug(str(client) + ' startReading')
                client.transport.startReading()
                connectionCount -= 1
                
        resetConnections += connectionCount

    Hellanzb.downloadPaused = False
    if resetConnections:
        info('Continuing downloader (%i connections were reset)' % resetConnections)
    else:
        info('Continuing downloader')

    def redoAssembly(nzbFile):
        nzbFile.tryAssemble()
        nzbFile.interruptedAssembly = False
        
    for nzb in Hellanzb.queue.currentNZBs():
        for nzbFile in nzb.nzbFiles:
            if nzbFile.interruptedAssembly:
                reactor.callInThread(redoAssembly, nzbFile)
    return True

def clearCurrent(andCancel):


Generated by  Doxygen 1.6.0   Back to index