Limit the number of subscriptions per user.

This limit is necessary to limit the size of subscription update
packets; it can be lifted when incremental subscription updates are
implemented.
This commit is contained in:
akwizgran
2013-02-07 18:13:58 +00:00
parent f4675c3edd
commit 78d6100262
8 changed files with 134 additions and 34 deletions

View File

@@ -297,8 +297,11 @@ public interface DatabaseComponent {
void setVisibility(GroupId g, Collection<ContactId> visible)
throws DbException;
/** Subscribes to the given group. */
void subscribe(Group g) throws DbException;
/**
* Subscribes to the given group, or returns false if the user already has
* the maximum number of subscriptions.
*/
boolean subscribe(Group g) throws DbException;
/**
* Unsubscribes from the given group. Any messages belonging to the group

View File

@@ -11,6 +11,9 @@ public interface MessagingConstants {
*/
int MAX_PACKET_LENGTH = MIN_CONNECTION_LENGTH / 2;
/** The maximum number of groups a user may subscribe to. */
int MAX_SUBSCRIPTIONS = 3000;
/** The maximum number of properties per transport. */
int MAX_PROPERTIES_PER_TRANSPORT = 100;