tahrir
tahrir copied to clipboard
Make relationship between broadcast classes more explicit
Currently MicroblogHandler works fine along with MicroblogSessionImpl but things are perhaps not as explicit as they should be. MicroblogHandler really has two "loops" one to move through Microblogs and another to move through peers broadcasting the particular Microblog chosen. These loops, especially the one iterating through peers broadcasting a particular message, are not as explicit as they should be and could cause for some bad bugs if changed down the line.
The main problem is with startBroadcastToPeer() being called recursively from outside MicroblogHandler which is not at all obvious. One solution might be to pass a thread into the session and then, once the session is complete, sent a notify message in order to get the next peer for the next session.