Erik Johnston
84e27a592d
Merge pull request #2490 from matrix-org/erikj/drop_left_room_events
...
Ignore incoming events for rooms that we have left
2017-10-10 11:58:32 +01:00
David Baker
c9f034b4ac
There was already a constant for this
...
also update copyright
2017-10-10 11:47:10 +01:00
David Baker
a9f9d68631
More optimisation
2017-10-10 11:38:31 +01:00
David Baker
707374d5dc
What year is it!? Who's the president!?
2017-10-10 11:21:41 +01:00
David Baker
89fa00ddff
Merge branch 'develop' into dbkr/channel_notifications
2017-10-10 11:20:17 +01:00
Richard van der Hoff
6a6cc27aee
fed server: process PDUs for different rooms in parallel
...
With luck, this will give a real-time improvement when there are many rooms and
the server ends up calling out to fetch missing events.
2017-10-09 18:30:31 +01:00
Richard van der Hoff
4c7c4d4061
Fed server: use a linearizer for ongoing transactions
...
We don't want to process the same transaction multiple times concurrently, so
use a linearizer.
2017-10-09 18:30:10 +01:00
Richard van der Hoff
ba5b9b80a5
fed server: refactor on_incoming_transaction
...
Move as much as possible to after the have_responded check, and reduce the
number of times we iterate over the pdu list.
2017-10-09 18:10:53 +01:00
Richard van der Hoff
a6e3222fe5
Fed server: Move origin-check code to _handle_received_pdu
...
The response-building code expects there to be an entry in the `results` list
for each entry in the pdu_list, so the early `continue` was messing this
up. That doesn't really matter, because all that the federation client does is
log any errors, but it's pretty poor form.
2017-10-09 17:53:32 +01:00
Richard van der Hoff
3cc852d339
Fancy logformatter to format exceptions better
...
This is a bit of an experimental change at this point; the idea is to see if it
helps us track down where our stack overflows are coming from by logging the
stack when the exception was caught and turned into a Failure. (We'll also need
edf2704420
).
If we deploy this, we'll be able to enable it via the log config yaml.
2017-10-09 17:44:42 +01:00
Richard van der Hoff
0eeaa25694
Merge pull request #2508 from matrix-org/rav/federation_queue_logcontexts
...
Fix up logcontext handling in (federation) TransactionQueue
2017-10-09 17:43:48 +01:00
Richard van der Hoff
aa3fac8057
Merge pull request #2507 from matrix-org/rav/execute_concurrently_log_contexts
...
Fix logcontext handling for concurrently_execute
2017-10-09 17:43:32 +01:00
Erik Johnston
e8496efe84
Fix up comment
2017-10-09 15:17:34 +01:00
Richard van der Hoff
01bbacf3c4
Fix up logcontext handling in (federation) TransactionQueue
...
Avoid using preserve_context_over_function, which has problems with respect to
logcontexts.
2017-10-06 22:39:25 +01:00
Richard van der Hoff
148428ce76
Fix logcontext handling for concurrently_execute
...
Avoid preserve_context_over_deferred, which is broken.
2017-10-06 22:24:28 +01:00
Richard van der Hoff
c8f568ddf9
Fix up deferred handling in federation.py
...
* Avoid preserve_context_over_deferred, which is broken
* set consumeErrors=True on defer.gatherResults, to avoid spurious "unhandled
failure" erros
2017-10-06 22:14:24 +01:00
Richard van der Hoff
3ddda939d3
some comments in the state res code
2017-10-05 14:58:17 +01:00
David Baker
f878e6f8af
Spam checking: add the invitee to user_may_invite
2017-10-05 14:02:28 +01:00
David Baker
269af961e9
Make be faster
2017-10-05 13:27:12 +01:00
David Baker
ed80c6b6cc
Add fastpath optimisation
2017-10-05 13:20:22 +01:00
David Baker
e433393c4f
pep8
2017-10-05 13:08:02 +01:00
David Baker
985ce80375
They're called rooms
2017-10-05 13:03:44 +01:00
David Baker
b9b9714fd5
Get rule type right
2017-10-05 13:02:19 +01:00
David Baker
fa969cfdde
Support for channel notifications
...
Add condition type to check the sender's power level and add a base
rule using it for @channel notifications.
2017-10-05 12:39:18 +01:00
David Baker
0c8da8b519
Use better method for word boundary searching
...
From ebc95667b8
2017-10-05 11:57:43 +01:00
Erik Johnston
eaaa837e00
Don't corrupt cache
2017-10-05 11:43:22 +01:00
David Baker
cbe3c3fdd4
pep8
2017-10-05 11:43:10 +01:00
David Baker
6748f0a579
Fix notif kws that start/end with non-word chars
...
Only prepend / append word bounary characters if the search
expression starts or ends with a word character, otherwise they
don't work because there's no word bounary between whitespace and
a non-word char.
2017-10-05 11:33:30 +01:00
David Baker
d8ce68b09b
spam check room publishing
2017-10-04 14:29:33 +01:00
David Baker
78d4ced829
un-double indent
2017-10-04 12:44:27 +01:00
David Baker
197c14dbcf
Add room creation checks to spam checker
...
Lets the spam checker deny attempts to create rooms and add aliases
to them.
2017-10-04 10:47:54 +01:00
David Baker
1e2ac54351
s/roomid/room_id/
2017-10-03 17:41:38 +01:00
David Baker
1e375468de
pass room id too
2017-10-03 17:13:14 +01:00
David Baker
c2c188b699
Federation was passing strings anyway
...
so pass string everywhere
2017-10-03 15:46:19 +01:00
David Baker
c46a0d7eb4
this shouldn't be debug
2017-10-03 15:20:14 +01:00
David Baker
bd769a81e1
better logging
2017-10-03 15:16:40 +01:00
David Baker
537088e7dc
Actually write warpper function
2017-10-03 14:28:12 +01:00
David Baker
41fd9989a2
Skip spam check for admin users
2017-10-03 14:17:44 +01:00
Erik Johnston
11d62f43c9
Invalidate cache
2017-10-03 14:12:28 +01:00
Erik Johnston
e4ab96021e
Update comments
2017-10-03 14:10:41 +01:00
David Baker
2a7ed700d5
Fix param name & lint
2017-10-03 14:04:10 +01:00
David Baker
84716d267c
Allow spam checker to reject invites too
2017-10-03 13:56:43 +01:00
Erik Johnston
f2da6df568
Remove spurious line feed
2017-10-03 11:31:06 +01:00
Erik Johnston
30848c0fcd
Ignore incoming events for rooms that we have left
...
When synapse receives an event for a room its not in over federation, it
double checks with the remote server to see if it is in fact in the
room. This is done so that if the server has forgotten about the room
(usually as a result of the database being dropped) it can recover from
it.
However, in the presence of state resets in large rooms, this can cause
a lot of work for servers that have legitimately left. As a hacky
solution that supports both cases we drop incoming events for rooms that
we have explicitly left.
This means that we no longer support the case of servers having
forgotten that they've rejoined a room, but that is sufficiently rare
that we're not going to support it for now.
2017-10-03 11:18:21 +01:00
Erik Johnston
e585c83209
Merge branch 'master' of github.com:matrix-org/synapse into develop
2017-10-02 18:11:24 +01:00
Erik Johnston
6c1bb1601e
Bump version and changelog
2017-10-02 18:05:17 +01:00
Erik Johnston
ea87cb1ba5
Make 'affinity' package optional
2017-10-02 18:03:59 +01:00
Erik Johnston
3fed5bb25f
Move quit_with_error
2017-10-02 17:59:34 +01:00
David Baker
27955056e0
Merge branch 'develop' into erikj/groups_merged
2017-10-02 16:20:41 +01:00
Erik Johnston
90d70af269
Merge branch 'master' of github.com:matrix-org/synapse into develop
2017-10-02 16:20:23 +01:00
Erik Johnston
e4a709eda3
Bump version and change log
2017-10-02 13:51:38 +01:00
Jeremy Cline
cafb8de132
Unfreeze event before serializing with ujson
...
In newer versions of https://github.com/esnme/ultrajson , ujson does not
serialize frozendicts (introduced in esnme/ultrajson@53f85b1 ). Although
the PyPI version is still 1.35, Fedora ships with a build from commit
esnme/ultrajson@2f1d487 . This causes the serialization to fail if the
distribution-provided package is used.
This runs the event through the unfreeze utility before serializing it.
Thanks to @ignatenkobrain for tracking down the root cause.
fixes #2351
Signed-off-by: Jeremy Cline <jeremy@jcline.org>
2017-09-30 11:22:37 -04:00
Richard van der Hoff
d5325d7ef1
Merge pull request #2480 from matrix-org/rav/federation_client_logging
...
Improve logging of failures in matrixfederationclient
2017-09-29 17:32:53 +01:00
Erik Johnston
d5694ac5fa
Only log if we've removed media
2017-09-28 16:08:08 +01:00
Richard van der Hoff
e43de3ae4b
Improve logging of failures in matrixfederationclient
...
* don't log exception types twice
* not all exceptions have a meaningful 'message'. Use the repr rather than
attempting to build a string ourselves.
2017-09-28 15:38:09 +01:00
Richard van der Hoff
75e67b9ee4
Handle SERVFAILs when doing AAAA lookups for federation ( #2477 )
...
... to cope with people with broken dnssec setups, mostly
2017-09-28 15:24:00 +01:00
Erik Johnston
768f00dedb
Up the limits on number of url cache entries to delete at one time
2017-09-28 14:27:27 +01:00
Erik Johnston
4dc07e93a8
Add old indices
2017-09-28 14:10:33 +01:00
Erik Johnston
7cc483aa0e
Clear up expired url cache every 10s
2017-09-28 13:56:53 +01:00
Erik Johnston
e1e7d76cf1
Actually assign result to variable
2017-09-28 13:55:29 +01:00
Erik Johnston
93247a424a
Only pull out local media that were for url cache
2017-09-28 13:48:14 +01:00
Erik Johnston
5f501ec7e2
Fix typo in url cache expiry timer
2017-09-28 12:59:01 +01:00
Erik Johnston
761d255fdf
Merge pull request #2479 from matrix-org/erikj/expire_url_cache_thumbnails
...
Support new and old style media id formats
2017-09-28 12:58:13 +01:00
Erik Johnston
ace8079086
Support new and old style media id formats
2017-09-28 12:52:51 +01:00
Erik Johnston
7a44c01d89
Fix typo
2017-09-28 12:46:04 +01:00
Erik Johnston
ae79764fe5
Change expires column to expires_ts
2017-09-28 12:37:53 +01:00
Erik Johnston
77f1d24de3
More brackets
2017-09-28 12:23:15 +01:00
Erik Johnston
9ccb4226ba
Delete expired url cache data
2017-09-28 12:18:06 +01:00
Erik Johnston
8090fd4664
Fix /joined_members to work with AS users
2017-09-28 10:09:32 +01:00
Erik Johnston
adec03395d
Fix bug where /joined_members didn't check user was in room
2017-09-27 15:14:39 +01:00
David Baker
ef3a5ae787
Don't test is spam_checker not None
...
Sometimes it's a Mock object which is not none but is still not
what we're after
2017-09-27 11:24:19 +01:00
David Baker
8c06dd6071
Remove unintentional debugging
2017-09-27 10:31:14 +01:00
David Baker
60c78666ab
pep8
2017-09-27 10:26:13 +01:00
David Baker
1786b0e768
Forgot the new file again :(
2017-09-27 10:22:54 +01:00
David Baker
6cd5fcd536
Make the spam checker a module
2017-09-26 19:20:23 +01:00
David Baker
9fd086e506
unnecessary parens
2017-09-26 17:59:46 +01:00
David Baker
0b03a97708
Add module_loader.py
2017-09-26 17:56:41 +01:00
David Baker
4824a33c31
Factor out module loading to a separate place
...
So it can be reused
2017-09-26 17:51:26 +01:00
Erik Johnston
17b8e2bd02
Add remove room API
2017-09-26 15:52:41 +01:00
Erik Johnston
a8e2a3df32
Add unique index to group_rooms table
2017-09-26 15:39:21 +01:00
Erik Johnston
95298783bb
Add is_publicised to group summary
2017-09-26 11:04:37 +01:00
Erik Johnston
1a398b19fd
Merge branch 'develop' of github.com:matrix-org/synapse into release-v0.23.0
2017-09-26 10:08:59 +01:00
Erik Johnston
f4c8cd5e85
Bump changelog and version
2017-09-26 10:02:48 +01:00
Erik Johnston
e3edca3b5d
Refactor to speed up incremental syncs
2017-09-25 17:35:39 +01:00
Erik Johnston
44edac0497
Merge branch 'release-v0.23.0' of github.com:matrix-org/synapse into develop
2017-09-25 14:52:46 +01:00
Richard van der Hoff
94133d7ce8
Merge branch 'develop' into develop
2017-09-25 11:50:11 +01:00
Erik Johnston
ba8fdc925c
Bump version and changes
2017-09-25 11:01:31 +01:00
Richard van der Hoff
79b3cf3e02
Fix logcontxt leak in keyclient ( #2465 )
...
preserve_context_over_function doesn't do what you want it to do.
2017-09-25 09:51:39 +01:00
Richard van der Hoff
f65e31d22f
Do an AAAA lookup on SRV record targets ( #2462 )
...
Support SRV records which point at AAAA records, as well as A records.
Fixes https://github.com/matrix-org/synapse/issues/2405
2017-09-22 20:26:47 +01:00
Matthew Hodgson
f496399ac4
fix thinko'd docstring
2017-09-22 15:34:14 +01:00
Erik Johnston
3166ed55b2
Fix device list when rejoining room ( #2461 )
2017-09-22 14:44:17 +01:00
Erik Johnston
e1dec2f1a7
Remove user from group summary when the leave the group
2017-09-21 16:09:57 +01:00
Erik Johnston
bb746a9de1
Revert: Keep room_id's in group summary
2017-09-21 15:57:22 +01:00
Erik Johnston
ae8d4bb0f0
Keep room_id's in group summary
2017-09-21 15:55:18 +01:00
Erik Johnston
197d82dc07
Correctly return next token
2017-09-20 11:12:11 +01:00
Erik Johnston
069ae2df12
Fix initial sync
2017-09-20 10:52:12 +01:00
Richard van der Hoff
6de74ea6d7
Fix logcontexts in _check_sigs_and_hashes
2017-09-20 01:32:42 +01:00
Richard van der Hoff
c5c24c239b
Fix logcontext handling in verify_json_objects_for_server
...
preserve_context_over_fn is essentially broken, because (a) it pointlessly
drops the current logcontext before calling its wrapped function, which means
we don't get any useful logcontexts for _handle_key_deferred; (b) it wraps the
resulting deferred in a _PreservingContextDeferred, which is very dangerous
because you then can't yield on it without leaking context back into the
reactor.
Instead, let's specify that the resultant deferreds call their callbacks with
no logcontext.
2017-09-20 01:32:42 +01:00
Richard van der Hoff
c5b0e9f485
Turn _start_key_lookups into an inlineCallbacks function
...
... which means that logcontexts can be correctly preserved for the stuff it
does.
get_server_verify_keys is now called with the logcontext, so needs to
preserve_fn when it fires off its nested inlineCallbacks function.
Also renames get_server_verify_keys to reflect the fact it's meant to be
private.
2017-09-20 01:32:42 +01:00
Richard van der Hoff
abdefb8a01
Fix potential race in _start_key_lookups
...
If the verify_request.deferred has already completed, then `remove_deferreds`
will be called immediately. It therefore might resolve the server_to_deferred
deferred while there are still other requests for that server in flight.
To avoid that, we should build the complete list of requests, and *then* add the
callbacks.
2017-09-20 01:32:42 +01:00
Richard van der Hoff
afbd773dc6
Add some comments to _start_key_lookups
2017-09-20 01:32:42 +01:00
Richard van der Hoff
2a4b9ea233
Consistency for how verify_request.deferred is called
...
Define that it is run with no log context, and make sure that happens.
If we aren't careful to reset the logcontext, we can't bung the deferreds into
defer.gatherResults etc. We don't actually do that directly, but we *do*
resolve other deferreds from affected callbacks (notably the server_to_deferred
map in _start_key_lookups), and those *do* get passed into
defer.gatherResults. It turns out that this way ends up being least confusing.
2017-09-20 01:32:42 +01:00
Richard van der Hoff
3b98439eca
Factor out _start_key_lookups
...
... to make it easier to see what's going on.
2017-09-20 01:32:42 +01:00
Richard van der Hoff
fde63b880d
Replace server_and_json
with verify_requests
...
This is a precursor to factoring some of this code out.
2017-09-20 01:32:42 +01:00
Richard van der Hoff
2d511defd9
pull out handle_key_deferred to top level
...
There's no need for this to be a nested definition; pulling it out not only
makes it more efficient, but makes it easier to check that it's not accessing
any local variables it shouldn't be.
2017-09-20 01:32:42 +01:00
Richard van der Hoff
dd1ea9763a
Fix incorrect key_ids in error message
2017-09-20 01:32:42 +01:00
Richard van der Hoff
e76d1135dd
Invalidate signing key cache when we gat an update
...
This might make the cache slightly more efficient.
2017-09-20 01:32:42 +01:00
Richard van der Hoff
fcf2c0fd1a
Remove redundant preserve_fn
...
preserve_fn is a no-op unless the wrapped function returns a
Deferred. verify_json_objects_for_server returns a list, so this is doing
nothing.
2017-09-20 01:32:42 +01:00
Richard van der Hoff
9864efa532
Fix concurrent server_key requests ( #2458 )
...
Fix a bug where we could end up firing off multiple requests for server_keys
for the same server at the same time.
2017-09-19 23:25:44 +01:00
Richard van der Hoff
aa620d09a0
Add a config option to block all room invites ( #2457 )
...
- allows sysadmins the ability to lock down their servers so that people can't
send their users room invites.
2017-09-19 16:08:14 +01:00
Richard van der Hoff
2eabdf3f98
add some comments to on_exchange_third_party_invite_request
2017-09-19 12:20:36 +01:00
Richard van der Hoff
5ed109d59f
PoC for filtering spammy events ( #2456 )
...
Demonstration of how you might add some hooks to filter out spammy events.
2017-09-19 12:20:11 +01:00
Erik Johnston
93e504d04e
Ensure that creator of group sees group down /sync
2017-09-19 11:08:16 +01:00
Erik Johnston
b5feaa5a49
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/groups_merged
2017-09-19 11:07:45 +01:00
Richard van der Hoff
3f405b34e9
Fix overzealous kicking of guest users ( #2453 )
...
We should only kick guest users if the guest access event is authorised.
2017-09-19 08:52:52 +01:00
Richard van der Hoff
290777b3d9
Clean up and document handling of logcontexts in Keyring ( #2452 )
...
I'm still unclear on what the intended behaviour for
`verify_json_objects_for_server` is, but at least I now understand the
behaviour of most of the things it calls...
2017-09-18 18:31:01 +01:00
Erik Johnston
77c81ca6ea
Merge pull request #2451 from matrix-org/erikj/add_state_to_timeline
...
Don't filter out current state events from timeline
2017-09-18 17:22:33 +01:00
Erik Johnston
2d1b7955ae
Don't filter out current state events from timeline
2017-09-18 17:13:03 +01:00
David Baker
862c8da560
Merge pull request #2450 from matrix-org/dbkr/push_event_id_only
...
Add support for event_id_only push format
2017-09-18 16:41:29 +01:00
David Baker
436ee0a2ea
Also include the room_id
...
as really it's part of the event ID
2017-09-18 15:58:38 +01:00
David Baker
b393f5db51
Use .get - it's much shorter
2017-09-18 15:50:26 +01:00
David Baker
a2562f9d74
Add support for event_id_only push format
...
Param in the data dict of a pusher that tells an HTTP pusher to
send just the event_id of the event it's notifying about and the
notification counts. For clients that want to go & fetch the body
of the event themselves anyway.
2017-09-18 15:39:39 +01:00
Erik Johnston
d6dadd95ac
Correctly handle leaving room in /key/changes
2017-09-18 15:38:22 +01:00
Erik Johnston
4a94eb3ea4
Fix typo
2017-09-15 09:56:54 +01:00
Erik Johnston
3a0cee28d6
Actually hook leave notifs up
2017-09-14 11:49:37 +01:00
Erik Johnston
4f845a0713
Handle joining/leaving rooms in /keys/changes
2017-09-13 16:28:08 +01:00
Erik Johnston
473700f016
Get left rooms
2017-09-13 15:13:41 +01:00
Erik Johnston
9ce866ed4f
In sync handle device lists for newly joined/left rooms
2017-09-12 16:44:26 +01:00
Erik Johnston
69ef4987a6
Add left section to /keys/changes
2017-09-08 14:44:36 +01:00
Erik Johnston
53cc8ad35a
Send down device list change notif when member leaves/rejoins room
2017-09-07 15:08:39 +01:00
Erik Johnston
4a9b1cf253
Add user profiles to summary from group server
2017-08-25 16:23:58 +01:00
Erik Johnston
258409ef61
Fix typos and reinherit
2017-08-25 14:45:20 +01:00
Erik Johnston
bf81f3cf2c
Split out profile handler to fix tests
2017-08-25 14:34:56 +01:00
Erik Johnston
27ebc5c8f2
Add remote profile cache
2017-08-25 11:25:47 +01:00
Erik Johnston
97c544f91f
Add _simple_update
2017-08-25 11:11:37 +01:00
Richard van der Hoff
a7effa8400
Merge pull request #2288 from kyrias/bcrypt
...
python_dependencies: Use bcrypt module instead of py-bcrypt
2017-08-23 14:14:56 +01:00
Erik Johnston
2800983f3e
Merge pull request #2410 from matrix-org/erikj/groups_publicise
...
Add ability to publicise group membership
2017-08-21 16:51:56 +01:00
Erik Johnston
8b50fe5330
Use BOOLEAN rather than TEXT type
2017-08-21 16:37:29 +01:00
Erik Johnston
175a01f56c
Groups: Fix mising json.load in initial sync
2017-08-21 14:45:56 +01:00
Richard van der Hoff
692250c6be
Fix user_dir startup
...
Add missing parameter to _base.start_worker_reactor
2017-08-16 15:11:29 +01:00
Richard van der Hoff
d2352347cf
Fix process startup
...
escape the % that got added in 92168cb
so that the process starts up ok.
2017-08-16 14:57:35 +01:00
Matthew Hodgson
92168cbbc5
explain why CPU affinity is a good idea
2017-08-15 18:27:42 +01:00
Richard van der Hoff
10d8b701a1
Allow configuration of CPU affinity
...
Make it possible to set the CPU affinity in the config file, so that we don't
need to remember to do it manually every time.
2017-08-15 17:08:28 +01:00
Richard van der Hoff
543c794a76
Factor out common application start
...
We have 10 copies of this code, and I don't really want to update each one
separately.
2017-08-15 17:04:40 +01:00
Erik Johnston
ba3ff7918b
Fixup
2017-08-11 13:42:42 +01:00
Erik Johnston
ef8e578677
Add bulk group publicised lookup API
2017-08-09 13:36:22 +01:00
Erik Johnston
b880ff190a
Allow update group publicity
2017-08-08 14:19:41 +01:00
Erik Johnston
05e21285aa
Store whether the user wants to publicise their membership of a group
2017-08-08 13:01:46 +01:00
hera
eae04f1952
fix english
2017-08-04 23:56:42 +01:00
hera
5699b05072
typo
2017-08-04 23:44:37 +01:00