Missing Following users in DHT

31 views
Skip to first unread message

Alan Chan

unread,
May 22, 2014, 9:30:11 PM5/22/14
to twiste...@googlegroups.com
Hi

I am new to Twister and am playing with it on my Mac for a couple of days. It's been great. But seems to have an issuer with following users list in DHT network.

When I run "./twisterd dhtget szelok following1 s", I get

"v" : [

                "twister",

                "mfreitas",

                "manob2",

                "erkanyuksel"

            ]

But I expect more.

When I run "../twisterd getfollowing szelok", I get the expected result

[

    "capo",

    "dionyziz",

    "erkanyuksel",

    "manob2",

    "mfreitas",

    "mollusk",

    "szelok",

    "toyg",

    "twister"

]

I looked at the debug.log. I don't see any error in dhtput when I click follow.

Please advise. Thanks

Erkan Yilmaz

unread,
May 23, 2014, 6:32:23 AM5/23/14
to twiste...@googlegroups.com
Hi,

for the 1st command I get the same result as you, but the 2nd command gives only:
./twisterd getfollowing szelok
[
]

and my twister-html GUI claims: you're only following 4 users

Twister version v0.9.20.0-unk-beta (May  6 2014, 08:50:34)




--
You received this message because you are subscribed to the Google Groups "twister-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to twister-user...@googlegroups.com.
To post to this group, send email to twiste...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Find me at: 

gnu/linux user #500092

**********************************************************************************************
This e-mail may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail.
Any unauthorised copying, disclosure or distribution of the material
in this e-mail is strictly forbidden.

Diese eMail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese eMail irrtuemlich erhalten
haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht
gestattet.
**********************************************************************************************
sze1.png

Miguel Freitas

unread,
May 23, 2014, 6:35:30 AM5/23/14
to twiste...@googlegroups.com
Did you add these users with "./twisterd follow" or using the html UI? The twister-html client is supposed to synchronize this dht resource with the local following list.

As you seem comfortable using twisterd command line, you might want to try doing the dhtput manually to find out if this is either a twister-html bug or an issue within twisterd/dht.

regards,

Miguel



--

Alan Chan

unread,
May 23, 2014, 8:27:57 AM5/23/14
to twiste...@googlegroups.com
I was using twister-html to "follow". the html shows expected results - consistent with "getfollowing".

Any idea?

Alan Chan

unread,
May 23, 2014, 11:42:26 AM5/23/14
to twiste...@googlegroups.com
Taking a look at the code. The bug is that it's using same _followingSeqNum again and again.

Reason being an old _followingSeqNum is being loaded from local storage after page refresh tiggered by follow - code below

    follow(username, true, function() {

        // delay reload so dhtput may do it's job

        window.setTimeout("location.reload();",500);

    });

And the old _followingSeqNum is in local storage because the old one get saved before the seq number get incremented (in saveFollowingToDht()).

function saveFollowing(cbFunc, cbArg) {

    saveFollowingToStorage();

    saveFollowingToDht();

    updateFollowing(cbFunc, cbArg);

}



Miguel Freitas

unread,
May 23, 2014, 1:24:40 PM5/23/14
to twiste...@googlegroups.com
Alan,

On Fri, May 23, 2014 at 12:42 PM, Alan Chan <szelo...@gmail.com> wrote:

And the old _followingSeqNum is in local storage because the old one get saved before the seq number get incremented (in saveFollowingToDht()).

function saveFollowing(cbFunc, cbArg) {

    saveFollowingToStorage();

    saveFollowingToDht();

    updateFollowing(cbFunc, cbArg);

}


Good catch! It should be safer if we revert the order: saveFollowingToDht() and then saveFollowingToStorage().

I'll commit this to repository. May you confirm it fixes the issue?

regards,

Miguel

Alan Chan

unread,
May 23, 2014, 1:55:50 PM5/23/14
to twiste...@googlegroups.com
Yes. That should address the issue. I will help check out.

A couple of suggestions for future rewrite
1. not expose dhtput in json RPC. it does not seem there is a need to do so
2. writeable/stateful calls should be made more "atomic" from client app perspective. Eg In this case - "follow" - client apps should make a single rpc call. Then twisterd will both do a dhtput and do a torrent subscription.
3. avoid refresh web page for better users experience.

my two cents


Miguel Freitas

unread,
May 23, 2014, 2:12:52 PM5/23/14
to twiste...@googlegroups.com
On Fri, May 23, 2014 at 2:55 PM, Alan Chan <szelo...@gmail.com> wrote:
Yes. That should address the issue. I will help check out.

A couple of suggestions for future rewrite
1. not expose dhtput in json RPC. it does not seem there is a need to do so
2. writeable/stateful calls should be made more "atomic" from client app perspective. Eg In this case - "follow" - client apps should make a single rpc call. Then twisterd will both do a dhtput and do a torrent subscription.

Ok, but this is one of the examples where having things separated allow finer control and additional features: dhtput may fail, so client may try different strategies to take care of that (moving it into twisterd should happen only when the winning strategy is chosen). also, twisterd/follow without the dhtput is what we call "private following". that is, you get your timeline updated with posts but people are not aware of your reading habits (who do you follow). That's something the user should decide, not the daemon.

 
3. avoid refresh web page for better users experience.


Definitely! I'm not a web app developer, so any help on this area is appreciated.

Another good example is the frequent local polling from browser to twisterd. I'm quite sure there are more advanced http techniques that allow the server to notify the browser on updates.

regards,

Miguel

Reply all
Reply to author
Forward
0 new messages