[anonymous] catch exceptions in dnspython
This commit is contained in:
		
							parent
							
								
									929cb56ae2
								
							
						
					
					
						commit
						068e93194d
					
				
					 1 changed files with 10 additions and 7 deletions
				
			
		| 
						 | 
					@ -1547,13 +1547,16 @@ class Connection:
 | 
				
			||||||
			query = '_xmpp-client._tcp.' + h.encode('utf-8')
 | 
								query = '_xmpp-client._tcp.' + h.encode('utf-8')
 | 
				
			||||||
			try:
 | 
								try:
 | 
				
			||||||
				if HAS_DNSPYTHON:
 | 
									if HAS_DNSPYTHON:
 | 
				
			||||||
					answers = [x for x in dns.resolver.query(query, 'SRV')]
 | 
										try:
 | 
				
			||||||
					if answers:
 | 
											answers = [x for x in dns.resolver.query(query, 'SRV')]
 | 
				
			||||||
						for a in answers:
 | 
											if answers:
 | 
				
			||||||
							hosts.append({'host': str(a.target),
 | 
												for a in answers:
 | 
				
			||||||
											'port': int(a.port),
 | 
													hosts.append({'host': str(a.target),
 | 
				
			||||||
											'prio': int(a.priority),
 | 
																	'port': int(a.port),
 | 
				
			||||||
											'weight': int(a.weight)})
 | 
																	'prio': int(a.priority),
 | 
				
			||||||
 | 
																	'weight': int(a.weight)})
 | 
				
			||||||
 | 
										except:
 | 
				
			||||||
 | 
											pass
 | 
				
			||||||
				elif HAS_PYDNS:
 | 
									elif HAS_PYDNS:
 | 
				
			||||||
					# ensure we haven't cached an old configuration
 | 
										# ensure we haven't cached an old configuration
 | 
				
			||||||
					DNS.ParseResolvConf()
 | 
										DNS.ParseResolvConf()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue