Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
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
Timo Ley
synapse
Commits
a7925259
Commit
a7925259
authored
10 years ago
by
Erik Johnston
Browse files
Options
Downloads
Plain Diff
Merge branch 'develop' of github.com:matrix-org/synapse into release-v0.7.1
parents
446ef589
7d304ae1
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
synapse/federation/transaction_queue.py
+27
-3
27 additions, 3 deletions
synapse/federation/transaction_queue.py
synapse/python_dependencies.py
+5
-5
5 additions, 5 deletions
synapse/python_dependencies.py
synapse/rest/media/v1/base_resource.py
+1
-1
1 addition, 1 deletion
synapse/rest/media/v1/base_resource.py
with
33 additions
and
9 deletions
synapse/federation/transaction_queue.py
+
27
−
3
View file @
a7925259
...
@@ -66,6 +66,26 @@ class TransactionQueue(object):
...
@@ -66,6 +66,26 @@ class TransactionQueue(object):
# HACK to get unique tx id
# HACK to get unique tx id
self
.
_next_txn_id
=
int
(
self
.
_clock
.
time_msec
())
self
.
_next_txn_id
=
int
(
self
.
_clock
.
time_msec
())
def
can_send_to
(
self
,
destination
):
"""
Can we send messages to the given server?
We can
'
t send messages to ourselves. If we are running on localhost
then we can only federation with other servers running on localhost.
Otherwise we only federate with servers on a public domain.
Args:
destination(str): The server we are possibly trying to send to.
Returns:
bool: True if we can send to the server.
"""
if
destination
==
self
.
server_name
:
return
False
if
self
.
server_name
.
startswith
(
"
localhost
"
):
return
destination
.
startswith
(
"
localhost
"
)
else
:
return
not
destination
.
startswith
(
"
localhost
"
)
@defer.inlineCallbacks
@defer.inlineCallbacks
@log_function
@log_function
def
enqueue_pdu
(
self
,
pdu
,
destinations
,
order
):
def
enqueue_pdu
(
self
,
pdu
,
destinations
,
order
):
...
@@ -74,8 +94,9 @@ class TransactionQueue(object):
...
@@ -74,8 +94,9 @@ class TransactionQueue(object):
# table and we'll get back to it later.
# table and we'll get back to it later.
destinations
=
set
(
destinations
)
destinations
=
set
(
destinations
)
destinations
.
discard
(
self
.
server_name
)
destinations
=
set
(
destinations
.
discard
(
"
localhost
"
)
dest
for
dest
in
destinations
if
self
.
can_send_to
(
dest
)
)
logger
.
debug
(
"
Sending to: %s
"
,
str
(
destinations
))
logger
.
debug
(
"
Sending to: %s
"
,
str
(
destinations
))
...
@@ -110,7 +131,7 @@ class TransactionQueue(object):
...
@@ -110,7 +131,7 @@ class TransactionQueue(object):
def
enqueue_edu
(
self
,
edu
):
def
enqueue_edu
(
self
,
edu
):
destination
=
edu
.
destination
destination
=
edu
.
destination
if
destination
==
self
.
server_name
or
destination
==
"
localhost
"
:
if
not
self
.
can_send_to
(
destination
)
:
return
return
deferred
=
defer
.
Deferred
()
deferred
=
defer
.
Deferred
()
...
@@ -139,6 +160,9 @@ class TransactionQueue(object):
...
@@ -139,6 +160,9 @@ class TransactionQueue(object):
deferred
=
defer
.
Deferred
()
deferred
=
defer
.
Deferred
()
if
not
self
.
can_send_to
(
destination
):
return
self
.
pending_failures_by_dest
.
setdefault
(
self
.
pending_failures_by_dest
.
setdefault
(
destination
,
[]
destination
,
[]
).
append
(
).
append
(
...
...
This diff is collapsed.
Click to expand it.
synapse/python_dependencies.py
+
5
−
5
View file @
a7925259
...
@@ -24,6 +24,11 @@ def github_link(project, version, egg):
...
@@ -24,6 +24,11 @@ def github_link(project, version, egg):
return
"
https://github.com/%s/tarball/%s/#egg=%s
"
%
(
project
,
version
,
egg
)
return
"
https://github.com/%s/tarball/%s/#egg=%s
"
%
(
project
,
version
,
egg
)
DEPENDENCY_LINKS
=
[
DEPENDENCY_LINKS
=
[
github_link
(
project
=
"
pyca/pynacl
"
,
version
=
"
d4d3175589b892f6ea7c22f466e0e223853516fa
"
,
egg
=
"
pynacl-0.3.0
"
,
),
github_link
(
github_link
(
project
=
"
matrix-org/syutil
"
,
project
=
"
matrix-org/syutil
"
,
version
=
"
v0.0.3
"
,
version
=
"
v0.0.3
"
,
...
@@ -34,11 +39,6 @@ DEPENDENCY_LINKS = [
...
@@ -34,11 +39,6 @@ DEPENDENCY_LINKS = [
version
=
"
v0.6.2
"
,
version
=
"
v0.6.2
"
,
egg
=
"
matrix_angular_sdk-0.6.2
"
,
egg
=
"
matrix_angular_sdk-0.6.2
"
,
),
),
github_link
(
project
=
"
pyca/pynacl
"
,
version
=
"
d4d3175589b892f6ea7c22f466e0e223853516fa
"
,
egg
=
"
pynacl-0.3.0
"
,
)
]
]
...
...
This diff is collapsed.
Click to expand it.
synapse/rest/media/v1/base_resource.py
+
1
−
1
View file @
a7925259
...
@@ -54,7 +54,7 @@ class BaseMediaResource(Resource):
...
@@ -54,7 +54,7 @@ class BaseMediaResource(Resource):
try
:
try
:
yield
request_handler
(
self
,
request
)
yield
request_handler
(
self
,
request
)
except
CodeMessageException
as
e
:
except
CodeMessageException
as
e
:
logger
.
exception
(
e
)
logger
.
info
(
"
Responding with error: %r
"
,
e
)
respond_with_json
(
respond_with_json
(
request
,
e
.
code
,
cs_exception
(
e
),
send_cors
=
True
request
,
e
.
code
,
cs_exception
(
e
),
send_cors
=
True
)
)
...
...
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