Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
24d59c75
Commit
24d59c75
authored
6 years ago
by
Richard van der Hoff
Browse files
Options
Downloads
Patches
Plain Diff
better logging for federation connections
parent
d428b463
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
synapse/http/federation/matrix_federation_agent.py
+16
-5
16 additions, 5 deletions
synapse/http/federation/matrix_federation_agent.py
with
16 additions
and
5 deletions
synapse/http/federation/matrix_federation_agent.py
+
16
−
5
View file @
24d59c75
...
...
@@ -23,6 +23,7 @@ from zope.interface import implementer
from
twisted.internet
import
defer
from
twisted.internet.endpoints
import
HostnameEndpoint
,
wrapClientTLS
from
twisted.internet.interfaces
import
IStreamClientEndpoint
from
twisted.web.client
import
URI
,
Agent
,
HTTPConnectionPool
,
RedirectAgent
,
readBody
from
twisted.web.http
import
stringToDatetime
from
twisted.web.http_headers
import
Headers
...
...
@@ -152,12 +153,9 @@ class MatrixFederationAgent(object):
class
EndpointFactory
(
object
):
@staticmethod
def
endpointForURI
(
_uri
):
logger
.
info
(
"
Connecting to %s:%i
"
,
res
.
target_host
.
decode
(
"
ascii
"
),
res
.
target_port
,
ep
=
LoggingHostnameEndpoint
(
self
.
_reactor
,
res
.
target_host
,
res
.
target_port
,
)
ep
=
HostnameEndpoint
(
self
.
_reactor
,
res
.
target_host
,
res
.
target_port
)
if
tls_options
is
not
None
:
ep
=
wrapClientTLS
(
tls_options
,
ep
)
return
ep
...
...
@@ -342,6 +340,19 @@ class MatrixFederationAgent(object):
defer
.
returnValue
(
result
)
@implementer
(
IStreamClientEndpoint
)
class
LoggingHostnameEndpoint
(
object
):
"""
A wrapper for HostnameEndpint which logs when it connects
"""
def
__init__
(
self
,
reactor
,
host
,
port
,
*
args
,
**
kwargs
):
self
.
host
=
host
self
.
port
=
port
self
.
ep
=
HostnameEndpoint
(
reactor
,
host
,
port
,
*
args
,
**
kwargs
)
def
connect
(
self
,
protocol_factory
):
logger
.
info
(
"
Connecting to %s:%i
"
,
self
.
host
,
self
.
port
)
return
self
.
ep
.
connect
(
protocol_factory
)
def
_cache_period_from_headers
(
headers
,
time_now
=
time
.
time
):
cache_controls
=
_parse_cache_control
(
headers
)
...
...
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