Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Weblate
gajim
Commits
35d0260a
Commit
35d0260a
authored
11 years ago
by
fedor.brunner
Browse files
Options
Downloads
Patches
Plain Diff
ignore address-related errors for getaddrinfo. Fixes #7611
cleanup of jingle_transport.py
parent
ccda82c1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/common/jingle_transport.py
+45
-34
45 additions, 34 deletions
src/common/jingle_transport.py
with
45 additions
and
34 deletions
src/common/jingle_transport.py
+
45
−
34
View file @
35d0260a
...
...
@@ -178,30 +178,39 @@ class JingleTransportSocks5(JingleTransport):
return
if
not
self
.
connection
:
return
local_ip_cand
=
[]
port
=
int
(
gajim
.
config
.
get
(
'
file_transfers_port
'
))
#type preference of connection type. XEP-0260 section 2.2
type_preference
=
126
c
=
{
'
host
'
:
self
.
connection
.
peerhost
[
0
]}
c
[
'
candidate_id
'
]
=
self
.
connection
.
connection
.
getAnID
()
c
[
'
port
'
]
=
port
c
[
'
type
'
]
=
'
direct
'
c
[
'
jid
'
]
=
self
.
ourjid
c
[
'
priority
'
]
=
(
2
**
16
)
*
type_preference
priority
=
(
2
**
16
)
*
type_preference
hosts
=
set
()
local_ip_cand
=
[]
c
=
{
'
host
'
:
self
.
connection
.
peerhost
[
0
],
'
candidate_id
'
:
self
.
connection
.
connection
.
getAnID
(),
'
port
'
:
port
,
'
type
'
:
'
direct
'
,
'
jid
'
:
self
.
ourjid
,
'
priority
'
:
priority
}
hosts
.
add
(
self
.
connection
.
peerhost
[
0
])
local_ip_cand
.
append
(
c
)
for
addr
in
socket
.
getaddrinfo
(
socket
.
gethostname
(),
None
):
if
not
addr
[
4
][
0
]
in
local_ip_cand
and
not
addr
[
4
][
0
].
startswith
(
'
127
'
):
c
=
{
'
host
'
:
addr
[
4
][
0
]}
c
[
'
candidate_id
'
]
=
self
.
connection
.
connection
.
getAnID
()
c
[
'
port
'
]
=
port
c
[
'
type
'
]
=
'
direct
'
c
[
'
jid
'
]
=
self
.
ourjid
c
[
'
priority
'
]
=
(
2
**
16
)
*
type_preference
c
[
'
initiator
'
]
=
self
.
file_props
.
sender
c
[
'
target
'
]
=
self
.
file_props
.
receiver
local_ip_cand
.
append
(
c
)
try
:
for
addrinfo
in
socket
.
getaddrinfo
(
socket
.
gethostname
(),
None
):
addr
=
addrinfo
[
4
][
0
]
if
not
addr
in
hosts
and
not
addr
.
startswith
(
'
127
'
):
c
=
{
'
host
'
:
addr
,
'
candidate_id
'
:
self
.
connection
.
connection
.
getAnID
(),
'
port
'
:
port
,
'
type
'
:
'
direct
'
,
'
jid
'
:
self
.
ourjid
,
'
priority
'
:
priority
,
'
initiator
'
:
self
.
file_props
.
sender
,
'
target
'
:
self
.
file_props
.
receiver
}
hosts
.
add
(
addr
)
local_ip_cand
.
append
(
c
)
except
socket
.
gaierror
:
pass
# ignore address-related errors for getaddrinfo
self
.
_add_candidates
(
local_ip_cand
)
...
...
@@ -209,6 +218,7 @@ class JingleTransportSocks5(JingleTransport):
if
not
self
.
connection
:
return
type_preference
=
126
priority
=
(
2
**
16
)
*
type_preference
additional_ip_cand
=
[]
port
=
int
(
gajim
.
config
.
get
(
'
file_transfers_port
'
))
ft_add_hosts
=
gajim
.
config
.
get
(
'
ft_add_hosts_to_send
'
)
...
...
@@ -216,14 +226,14 @@ class JingleTransportSocks5(JingleTransport):
if
ft_add_hosts
:
hosts
=
[
e
.
strip
()
for
e
in
ft_add_hosts
.
split
(
'
,
'
)]
for
h
in
hosts
:
c
=
{
'
host
'
:
h
}
c
[
'
candidate_id
'
]
=
self
.
connection
.
connection
.
getAnID
()
c
[
'
port
'
]
=
port
c
[
'
type
'
]
=
'
direct
'
c
[
'
jid
'
]
=
self
.
ourjid
c
[
'
priority
'
]
=
(
2
**
16
)
*
type_preference
c
[
'
initiator
'
]
=
self
.
file_props
.
sender
c
[
'
target
'
]
=
self
.
file_props
.
receiver
c
=
{
'
host
'
:
h
,
'
candidate_id
'
:
self
.
connection
.
connection
.
getAnID
()
,
'
port
'
:
port
,
'
type
'
:
'
direct
'
,
'
jid
'
:
self
.
ourjid
,
'
priority
'
:
priority
,
'
initiator
'
:
self
.
file_props
.
sender
,
'
target
'
:
self
.
file_props
.
receiver
}
additional_ip_cand
.
append
(
c
)
self
.
_add_candidates
(
additional_ip_cand
)
...
...
@@ -232,6 +242,7 @@ class JingleTransportSocks5(JingleTransport):
if
not
self
.
connection
:
return
type_preference
=
10
priority
=
(
2
**
16
)
*
type_preference
proxy_cand
=
[]
socks5conn
=
self
.
connection
proxyhosts
=
socks5conn
.
_get_file_transfer_proxies_from_config
(
self
.
file_props
)
...
...
@@ -240,14 +251,14 @@ class JingleTransportSocks5(JingleTransport):
self
.
file_props
.
proxyhosts
=
proxyhosts
for
proxyhost
in
proxyhosts
:
c
=
{
'
host
'
:
proxyhost
[
'
host
'
]
}
c
[
'
candidate_id
'
]
=
self
.
connection
.
connection
.
getAnID
()
c
[
'
port
'
]
=
int
(
proxyhost
[
'
port
'
])
c
[
'
type
'
]
=
'
proxy
'
c
[
'
jid
'
]
=
proxyhost
[
'
jid
'
]
c
[
'
priority
'
]
=
(
2
**
16
)
*
type_preference
c
[
'
initiator
'
]
=
self
.
file_props
.
sender
c
[
'
target
'
]
=
self
.
file_props
.
receiver
c
=
{
'
host
'
:
proxyhost
[
'
host
'
]
,
'
candidate_id
'
:
self
.
connection
.
connection
.
getAnID
()
,
'
port
'
:
int
(
proxyhost
[
'
port
'
])
,
'
type
'
:
'
proxy
'
,
'
jid
'
:
proxyhost
[
'
jid
'
]
,
'
priority
'
:
priority
,
'
initiator
'
:
self
.
file_props
.
sender
,
'
target
'
:
self
.
file_props
.
receiver
}
proxy_cand
.
append
(
c
)
self
.
_add_candidates
(
proxy_cand
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment