disconnect only if we use keepalive
This commit is contained in:
		
							parent
							
								
									d29bbbee55
								
							
						
					
					
						commit
						a0d4506533
					
				
					 1 changed files with 8 additions and 9 deletions
				
			
		|  | @ -1179,16 +1179,15 @@ class Connection: | ||||||
| 					if time.time() > (self.last_incoming + keep_alive_every_foo_secs)\ | 					if time.time() > (self.last_incoming + keep_alive_every_foo_secs)\ | ||||||
| 					and not self.keep_alive_sent: #should we send keepalive? | 					and not self.keep_alive_sent: #should we send keepalive? | ||||||
| 						self.send_keepalive() | 						self.send_keepalive() | ||||||
| 						return |  | ||||||
| 				 | 				 | ||||||
| 					# did the server reply to the keepalive? if no disconnect | 					# did the server reply to the keepalive? if no disconnect | ||||||
| 					keep_alive_disconnect_secs = gajim.config.get_per('accounts', | 					keep_alive_disconnect_secs = gajim.config.get_per('accounts', | ||||||
| 						self.name, 'keep_alive_disconnect_secs') # 2 mins by default | 						self.name, 'keep_alive_disconnect_secs') # 2 mins by default | ||||||
| 					if time.time() > (self.last_incoming + keep_alive_disconnect_secs): | 					if time.time() > (self.last_incoming + keep_alive_disconnect_secs): | ||||||
| 						self.connection.disconnect() # disconnect if no answer | 						self.connection.disconnect() # disconnect if no answer | ||||||
| 					msg = str(keep_alive_disconnect_secs) +\ | 						msg = '%s seconds have passed and server did not reply to our keepalive. Gajim disconnected from %s' % (str(keep_alive_disconnect_secs), self.name) | ||||||
| 		' seconds have passed and server did not reply to our keepalive. Gajim disconnected from ' + self.name |  | ||||||
| 						gajim.log.debug(msg) | 						gajim.log.debug(msg) | ||||||
|  | 						return | ||||||
| 				self.connection.Process(timeout) | 				self.connection.Process(timeout) | ||||||
| 			except: | 			except: | ||||||
| 				gajim.log.debug('error appeared while processing xmpp:') | 				gajim.log.debug('error appeared while processing xmpp:') | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue