From 7993e3d10dd5b33f6443b974b36b988130f1b156 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Tue, 2 Dec 2014 17:20:02 +0000 Subject: SYN-187: Set a more sensible default for the content_addr --- synapse/config/server.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'synapse') diff --git a/synapse/config/server.py b/synapse/config/server.py index 814a4c349b..f8a0844b8c 100644 --- a/synapse/config/server.py +++ b/synapse/config/server.py @@ -35,8 +35,11 @@ class ServerConfig(Config): if not args.content_addr: host = args.server_name if ':' not in host: - host = "%s:%d" % (host, args.bind_port) - args.content_addr = "https://%s" % (host,) + host = "%s:%d" % (host, args.unsecure_port) + else: + host = host.split(':')[0] + host = "%s:%d" % (host, args.unsecure_port) + args.content_addr = "http://%s" % (host,) self.content_addr = args.content_addr -- cgit 1.4.1 From 23a2c42469ab7af46ffb44de2bfeae1240930a22 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 2 Dec 2014 17:45:40 +0000 Subject: Bump version --- CHANGES.rst | 7 +++++++ VERSION | 2 +- synapse/__init__.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'synapse') diff --git a/CHANGES.rst b/CHANGES.rst index 6779a36f72..477a404721 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,10 @@ +Changes in synapse 0.5.3c (2014-12-02) +====================================== + + * Change the default value for the `content_addr` option to use the HTTP + listener, as by default the HTTPS listener will be using a self-signed + certificate. + Changes in synapse 0.5.3 (2014-11-27) ===================================== diff --git a/VERSION b/VERSION index dc74c5626d..b6f145ad19 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.3a +0.5.3c diff --git a/synapse/__init__.py b/synapse/__init__.py index 658574dab9..0b43932305 100644 --- a/synapse/__init__.py +++ b/synapse/__init__.py @@ -16,4 +16,4 @@ """ This is a reference implementation of a synapse home server. """ -__version__ = "0.5.3a" +__version__ = "0.5.3c" -- cgit 1.4.1 From afb646dc1e7a91ee7a050632d1e5a5883830d18c Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Tue, 2 Dec 2014 18:00:51 +0000 Subject: Allow GET /room/:room_id/messages without 'limit' parameter to default to 10 --- synapse/rest/room.py | 4 +++- synapse/streams/config.py | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'synapse') diff --git a/synapse/rest/room.py b/synapse/rest/room.py index cc6ffb9aff..3147d7a60b 100644 --- a/synapse/rest/room.py +++ b/synapse/rest/room.py @@ -327,7 +327,9 @@ class RoomMessageListRestServlet(RestServlet): @defer.inlineCallbacks def on_GET(self, request, room_id): user = yield self.auth.get_user_by_req(request) - pagination_config = PaginationConfig.from_request(request) + pagination_config = PaginationConfig.from_request(request, + default_limit=10, + ) with_feedback = "feedback" in request.args handler = self.handlers.message_handler msgs = yield handler.get_messages( diff --git a/synapse/streams/config.py b/synapse/streams/config.py index 0317e78c08..2114c940e7 100644 --- a/synapse/streams/config.py +++ b/synapse/streams/config.py @@ -47,7 +47,8 @@ class PaginationConfig(object): self.limit = int(limit) if limit is not None else None @classmethod - def from_request(cls, request, raise_invalid_params=True): + def from_request(cls, request, raise_invalid_params=True, + default_limit=None): def get_param(name, default=None): lst = request.args.get(name, []) if len(lst) > 1: @@ -84,6 +85,9 @@ class PaginationConfig(object): if limit is not None and not limit.isdigit(): raise SynapseError(400, "'limit' parameter must be an integer.") + if limit is None: + limit = default_limit + try: return PaginationConfig(from_tok, to_tok, direction, limit) except: -- cgit 1.4.1 From 307f94dcbe0a78de4f5bba9aeb53102cd201a961 Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Tue, 2 Dec 2014 20:51:12 +0000 Subject: Squash room_ids list to a set() to remove duplicates - with TODO marker as I have no idea /why/ the dups are happening in the first place --- synapse/handlers/room.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'synapse') diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index 88955160c5..a000b44036 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -519,7 +519,11 @@ class RoomMemberHandler(BaseHandler): user_id=user.to_string(), membership_list=membership_list ) - defer.returnValue([r.room_id for r in rooms]) + # For some reason the list of events contains duplicates + # TODO(paul): work out why because I really don't think it should + room_ids = set(r.room_id for r in rooms) + + defer.returnValue(room_ids) @defer.inlineCallbacks def _do_local_membership_update(self, event, membership, snapshot, -- cgit 1.4.1 From 274d137b00ceab22f01c07461bce18f8916b54bd Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Tue, 2 Dec 2014 20:51:28 +0000 Subject: Extra verbosity on logging of received presence info --- synapse/handlers/presence.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'synapse') diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py index b55d589daf..815d40f166 100644 --- a/synapse/handlers/presence.py +++ b/synapse/handlers/presence.py @@ -651,11 +651,16 @@ class PresenceHandler(BaseHandler): logger.debug("Incoming presence update from %s", user) observers = set(self._remote_recvmap.get(user, set())) + if observers: + logger.debug(" | %d interested local observers %r", len(observers), observers) rm_handler = self.homeserver.get_handlers().room_member_handler room_ids = yield rm_handler.get_rooms_for_user(user) + if room_ids: + logger.debug(" | %d interested room IDs %r", len(room_ids), room_ids) if not observers and not room_ids: + logger.debug(" | no interested observers or room IDs") continue state = dict(push) -- cgit 1.4.1 From 10eb8f070cc5e4fc5067c98ef699724716e33f74 Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Tue, 2 Dec 2014 21:36:53 +0000 Subject: Workaround for non-uniqueness of room member events in the database confusing HAVING COUNT() test of room membership intersection (with thanks to Tom Molesworth) --- synapse/storage/roommember.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'synapse') diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py index c37df59d45..05b275663e 100644 --- a/synapse/storage/roommember.py +++ b/synapse/storage/roommember.py @@ -218,7 +218,9 @@ class RoomMemberStore(SQLBaseStore): "ON m.event_id = c.event_id " "WHERE m.membership = 'join' " "AND (%(clause)s) " - "GROUP BY m.room_id HAVING COUNT(m.room_id) = ?" + # TODO(paul): We've got duplicate rows in the database somewhere + # so we have to DISTINCT m.user_id here + "GROUP BY m.room_id HAVING COUNT(DISTINCT m.user_id) = ?" ) % {"clause": user_list_clause} args = list(user_id_list) -- cgit 1.4.1 From 66b0596b7a0995cfc4ca72ba2062014e3f9b8577 Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Tue, 2 Dec 2014 22:28:18 +0000 Subject: Don't log synapse.storage at DEBUG level when under -v; require -v -v for that --- synapse/config/logger.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'synapse') diff --git a/synapse/config/logger.py b/synapse/config/logger.py index 8566296433..089d906fa5 100644 --- a/synapse/config/logger.py +++ b/synapse/config/logger.py @@ -52,12 +52,18 @@ class LoggingConfig(Config): if self.log_config is None: level = logging.INFO + level_for_storage = logging.INFO if self.verbosity: level = logging.DEBUG + if self.verbosity > 1: + level_for_storage = logging.DEBUG # FIXME: we need a logging.WARN for a -q quiet option logger = logging.getLogger('') logger.setLevel(level) + + logging.getLogger('synapse.storage').setLevel(level_for_storage) + formatter = logging.Formatter(log_format) if self.log_file: handler = logging.FileHandler(self.log_file) -- cgit 1.4.1 From d06dfc70b0c03c5bfa4a4977e406166cef36ee8b Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 3 Dec 2014 11:50:23 +0000 Subject: Fix bug where did not always resolve all the deferreds in _attempt_new_transaction --- synapse/federation/replication.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'synapse') diff --git a/synapse/federation/replication.py b/synapse/federation/replication.py index 312d69fcaa..01f87fe423 100644 --- a/synapse/federation/replication.py +++ b/synapse/federation/replication.py @@ -853,7 +853,10 @@ class _TransactionQueue(object): # Ensures we don't continue until all callbacks on that # deferred have fired - yield deferred + try: + yield deferred + except: + pass logger.debug("TX [%s] Yielded to callbacks", destination) @@ -865,7 +868,8 @@ class _TransactionQueue(object): logger.exception(e) for deferred in deferreds: - deferred.errback(e) + if not deferred.called: + deferred.errback(e) finally: # We want to be *very* sure we delete this after we stop processing -- cgit 1.4.1