loadRosterOnLogin has non-trivial side effect on getRoster

Description

getRoster() is automatically called on login unless loadRosterOnLogin is set to false. However getRoster triggers a reload of the roster if loadRosterOnLogin is set to false. This means that 2 calls to getRoster cause no aditional network traffic when loadRosterOnLogin is set to true and two roster fetches otherwise. The impact of loadRosterOnLogin on getRoster is counter intuitive, makes optimizations hard and is not documented.

Steps to reproduce:

  • set loadRosterOnLogin to false

  • call getRoster

  • call getRoster

Expected result:

  • the roster engine is initialized uponfile:///home/treffer/work first getRoster

Actual result

  • The roster is loaded twice

Possible solution:

  • use roster.rosterInitialized to determin the state of the roster engine

  • trigger a roster load if needed

  • don't use loadRosterOnLogin after login

This may require apps insisting on the reload logic to do a manual "reload" after getRoster. However it's unlikely that apps do it via getRoster() (as you have events and a reload method).

The trivial patch for this would be http://github.com/rtreffer/smack/commit/59352e14227f9f433478a7fe53556c7dc94f9d11

Environment

None

Attachments

1

Activity

Show:

Florian Schmaus 
May 21, 2016 at 11:04 AM

Fixed with the changed Roster implementation.

Fixed

Details

Assignee

Reporter

Labels

Components

Fix versions

Affects versions

Priority

Created March 25, 2010 at 2:36 AM
Updated May 21, 2016 at 11:04 AM
Resolved May 21, 2016 at 11:04 AM