Indicate that some methods are only intended for internal usage.

This commit is contained in:
Stephan Erb 2008-11-26 21:11:08 +00:00
parent 4cf9d0d622
commit e0a365a234
1 changed files with 10 additions and 10 deletions

View File

@ -378,7 +378,7 @@ class Connection(ConnectionHandlers):
elif event == common.xmpp.transports.DATA_SENT: elif event == common.xmpp.transports.DATA_SENT:
self.dispatch('STANZA_SENT', unicode(data)) self.dispatch('STANZA_SENT', unicode(data))
def select_next_host(self, hosts): def _select_next_host(self, hosts):
'''Chooses best 'real' host basing on the SRV priority and weight data; '''Chooses best 'real' host basing on the SRV priority and weight data;
more info in RFC2782''' more info in RFC2782'''
hosts_best_prio = [] hosts_best_prio = []
@ -510,7 +510,7 @@ class Connection(ConnectionHandlers):
ssl_p = gajim.config.get_per('accounts', self.name, 'custom_port') ssl_p = gajim.config.get_per('accounts', self.name, 'custom_port')
for i in self._hosts: for i in self._hosts:
i['ssl_port'] = ssl_p i['ssl_port'] = ssl_p
self.connect_to_next_host() self._connect_to_next_host()
def on_proxy_failure(self, reason): def on_proxy_failure(self, reason):
log.debug('Connection to proxy failed') log.debug('Connection to proxy failed')
@ -521,7 +521,7 @@ class Connection(ConnectionHandlers):
self.dispatch('CONNECTION_LOST', self.dispatch('CONNECTION_LOST',
(_('Connection to proxy failed'), reason)) (_('Connection to proxy failed'), reason))
def connect_to_next_type(self, retry=False): def _connect_to_next_type(self, retry=False):
log.debug('Connection to next type') log.debug('Connection to next type')
if len(self._connection_types): if len(self._connection_types):
self._current_type = self._connection_types.pop(0) self._current_type = self._connection_types.pop(0)
@ -537,12 +537,12 @@ class Connection(ConnectionHandlers):
con = common.xmpp.NonBlockingClient(self._hostname, debug = d, con = common.xmpp.NonBlockingClient(self._hostname, debug = d,
caller = self, on_connect = self.on_connect_success, caller = self, on_connect = self.on_connect_success,
on_proxy_failure = self.on_proxy_failure, on_proxy_failure = self.on_proxy_failure,
on_connect_failure = self.connect_to_next_type) on_connect_failure = self._connect_to_next_type)
else: else:
con = common.xmpp.NonBlockingClient(self._hostname, debug = [], con = common.xmpp.NonBlockingClient(self._hostname, debug = [],
caller = self, on_connect = self.on_connect_success, caller = self, on_connect = self.on_connect_success,
on_proxy_failure = self.on_proxy_failure, on_proxy_failure = self.on_proxy_failure,
on_connect_failure = self.connect_to_next_type) on_connect_failure = self._connect_to_next_type)
self.last_connection = con self.last_connection = con
# increase default timeout for server responses # increase default timeout for server responses
common.xmpp.dispatcher_nb.DEFAULT_TIMEOUT_SECONDS = self.try_connecting_for_foo_secs common.xmpp.dispatcher_nb.DEFAULT_TIMEOUT_SECONDS = self.try_connecting_for_foo_secs
@ -565,9 +565,9 @@ class Connection(ConnectionHandlers):
con.connect((self._current_host['host'], port), proxy=self._proxy, con.connect((self._current_host['host'], port), proxy=self._proxy,
secure = secur) secure = secur)
else: else:
self.connect_to_next_host(retry) self._connect_to_next_host(retry)
def connect_to_next_host(self, retry = False): def _connect_to_next_host(self, retry = False):
log.debug('Connection to next host') log.debug('Connection to next host')
if len(self._hosts): if len(self._hosts):
# No config option exist when creating a new account # No config option exist when creating a new account
@ -581,10 +581,10 @@ class Connection(ConnectionHandlers):
'connection_types').split() 'connection_types').split()
else: else:
self._connection_types = ['tls', 'ssl', 'plain'] self._connection_types = ['tls', 'ssl', 'plain']
host = self.select_next_host(self._hosts) host = self._select_next_host(self._hosts)
self._current_host = host self._current_host = host
self._hosts.remove(host) self._hosts.remove(host)
self.connect_to_next_type() self._connect_to_next_type()
else: else:
if not retry and self.retrycount == 0: if not retry and self.retrycount == 0:
@ -619,7 +619,7 @@ class Connection(ConnectionHandlers):
if _con_type == 'tcp': if _con_type == 'tcp':
_con_type = 'plain' _con_type = 'plain'
if _con_type != self._current_type: if _con_type != self._current_type:
self.connect_to_next_type() self._connect_to_next_type()
return return
con.RegisterDisconnectHandler(self._on_disconnected) con.RegisterDisconnectHandler(self._on_disconnected)
if _con_type == 'plain' and gajim.config.get_per('accounts', self.name, if _con_type == 'plain' and gajim.config.get_per('accounts', self.name,