Beispiel #1
0
    def connectionLost(self, reason):
        self.log.add("Client is losing connection!")
        if self.isFile == False:
            print 'connection lost'
            if self.isSyncChange == True:
                print 'sync status changed'
        if self.isFile == True:
            basic.LineReceiver.connectionLost(self, reason)
            print ' - connectionLost'
            if self.outfile:
                self.outfile.close()
                # Problem uploading - tmpfile will be discarded
            if self.remain != 0:
                print str(self.remain) + ')!=0'
                remove_base = '--> removing tmpfile@'
                if self.remain<0:
                    reason = ' .. file moved too much'
                if self.remain>0:
                    reason = ' .. file moved too little'
                print remove_base + self.outfilename + reason
                os.remove(self.outfilename)

            # Success uploading - tmpfile will be saved to disk.
            else:

                user_address = self.transport.getPeer().host

                #self.factory.sendToMachines(user_address, self.outfilename)
                if ".enc" in self.outfilename:
                    fileCrypto.decrypt_file('somekey', self.outfilename)
                    os.remove(self.outfilename)
                print '\n--> finished saving upload@' + self.outfilename
Beispiel #2
0
    def connectionLost(self, reason):
        """ """
        basic.LineReceiver.connectionLost(self, reason)
        print ' - connectionLost'
        if self.outfile:
            self.outfile.close()
            # Problem uploading - tmpfile will be discarded
        if self.remain != 0:
            print str(self.remain) + ')!=0'
            remove_base = '--> removing tmpfile@'
            if self.remain<0:
                reason = ' .. file moved too much'
            if self.remain>0:
                reason = ' .. file moved too little'
            print remove_base + self.outfilename + reason
            os.remove(self.outfilename)

        # Success uploading - tmpfile will be saved to disk.
        else:

            user_address = self.transport.getPeer().host

            self.factory.sendToMachines(user_address, self.outfilename)
            fileCrypto.decrypt_file('somekey', self.outfilename)
            os.remove(self.outfilename)

            print '\n--> finished saving upload@' + self.outfilename
Beispiel #3
0
    def connectionLost(self, reason):
        """ """
        basic.LineReceiver.connectionLost(self, reason)
        if self.outfile:
            self.outfile.close()
            # Problem uploading - tmpfile will be discarded
        if self.remain != 0:
            remove_base = '--> removing tmpfile@'
            if self.remain<0:
                reason = ' .. file moved too much'
            if self.remain>0:
                reason = ' .. file moved too little'
            os.remove(self.outfilename)

        # Else: Success uploading - tmpfile will be saved to disk.
        else:
            fileCrypto.decrypt_file('somekey', self.outfilename)
            os.remove(self.outfilename)
            print "uploaded to"
Beispiel #4
0
    def connectionLost(self, reason):
        """ """
        basic.LineReceiver.connectionLost(self, reason)
        print " - connectionLost"
        if self.outfile:
            self.outfile.close()
            # Problem uploading - tmpfile will be discarded
        if self.remain != 0:
            print str(self.remain) + ")!=0"
            remove_base = "--> removing tmpfile@"
            if self.remain < 0:
                reason = " .. file moved too much"
            if self.remain > 0:
                reason = " .. file moved too little"
            print remove_base + self.outfilename + reason
            os.remove(self.outfilename)

        # Success uploading - tmpfile will be saved to disk.
        else:

            # Add some stuff here

            # get client connected to using .getPeer() -->

            user_address = self.transport.getPeer().host

            # get username from the connection; call it username

            # self.factory.sendToMachines(user_address, self.outfilename)

            print "\n--> finished saving upload@" + self.outfilename

            print "user_address is ", user_address

            print "about to call sendToMachines()"

            self.factory.sendToMachines(user_address, self.outfilename)
            fileCrypto.decrypt_file("somekey", self.outfilename)
            os.remove(self.outfilename)
Beispiel #5
0
    def connectionLost(self, reason):
        """ """
        basic.LineReceiver.connectionLost(self, reason)
        print ' - connectionLost'
        if self.outfile:
            self.outfile.close()
            # Problem uploading - tmpfile will be discarded
        if self.remain != 0:
            print str(self.remain) + ')!=0'
            remove_base = '--> removing tmpfile@'
            if self.remain<0:
                reason = ' .. file moved too much'
            if self.remain>0:
                reason = ' .. file moved too little'
            print remove_base + self.outfilename + reason
            if "MOV;" not in self.outfilename:
                os.remove(self.outfilename)

        # Success uploading - tmpfile will be saved to disk.
        else:
                fileCrypto.decrypt_file('somekey', self.outfilename)
                os.remove(self.outfilename)
                print '\n--> finished saving upload@' + self.outfilename