hopefully fixed block issues
This commit is contained in:
		
							parent
							
								
									38ad6559c3
								
							
						
					
					
						commit
						2769673abd
					
				
					 3 changed files with 7 additions and 5 deletions
				
			
		|  | @ -147,6 +147,8 @@ class OnionrCommunicate: | |||
|                 digest = digest.decode() | ||||
|             if digest == hash.strip(): | ||||
|                 self._core.setData(data) | ||||
|                 if data.startswith('-txt-'): | ||||
|                     self._core.setBlockType(hash, 'txt') | ||||
|                 logger.info('Successfully obtained data for ' + hash) | ||||
|                 if len(data) < 120: | ||||
|                     logger.debug('Block text:\n' + data) | ||||
|  | @ -165,7 +167,7 @@ class OnionrCommunicate: | |||
|         if data != None: | ||||
|             url = url + '&data=' + data | ||||
|         try: | ||||
|             r = requests.get(url, headers=headers, proxies=proxies, timeout=(5, 30)) | ||||
|             r = requests.get(url, headers=headers, proxies=proxies, timeout=(15, 30)) | ||||
|         except requests.exceptions.RequestException as e: | ||||
|             logger.warn(action + " failed with peer " + peer + ": " + str(e)) | ||||
|             return False | ||||
|  |  | |||
|  | @ -366,8 +366,8 @@ class Core: | |||
|     def setBlockType(self, hash, blockType): | ||||
|         conn = sqlite3.connect(self.blockDB) | ||||
|         c = conn.cursor() | ||||
|         if blockType not in ("txt"): | ||||
|             return | ||||
|         c.execute("UPDATE hashes set dataType='" + blockType + "' where hash = '" + hash + "';") | ||||
|         #if blockType not in ("txt"): | ||||
|         #    return | ||||
|         c.execute("UPDATE hashes SET dataType='" + blockType + "' WHERE hash = '" + hash + "';") | ||||
|         conn.commit() | ||||
|         conn.close() | ||||
|  | @ -49,7 +49,7 @@ class OnionrGUI: | |||
|         self.root.mainloop()  | ||||
| 
 | ||||
|     def sendMessage(self): | ||||
|         messageToAdd = self.sendEntry.get() | ||||
|         messageToAdd = '-txt-' + self.sendEntry.get() | ||||
|         addedHash = self.myCore.setData(messageToAdd) | ||||
|         self.myCore.addToBlockDB(addedHash, selfInsert=True) | ||||
|         self.myCore.setBlockType(addedHash, 'txt') | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue