Example #1
0
 def senderThread():
     try:
         aesKey = calculateDHAES(selectedPeer.publicKey, filePrivateKey)
         sentFile = File(fileName, fileContents, aesKey)
         self.sendRequestToPeer(guid, REQUEST_TYPE_SEND, objectToJSON(sentFile), 5)
         self.progressStop()
     except FileTransferBaseException as e:
         self.showMessageBox.emit(e.message)
Example #2
0
 def fileReceiverThread():
     self.progressIndeterminate()
     socket.setTimeout(5)
     if not ((request.guid in self.preSendRegistrations) and self.preSendRegistrations[request.guid]):
         self.showMessageBox.emit("No presend registration")
         return
     registration = self.preSendRegistrations[request.guid]
     self.preSendRegistrations[request.guid] = False
     receivedFile = JSONToObject(File, request.data)
     if registration.fileName != receivedFile.fileName:
         self.showMessageBox.emit("Name mismatch, rejected")
         self.progressStop()
         return
     aesKey = calculateDHAES(registration.publicKey.key, self.peers[request.guid].myPrivateKey)
     fileContents = receivedFile.getContents(aesKey)
     self.fileReceived.emit(receivedFile.fileName, fileContents)
     self.progressStop()