Help with patch to ignore peers sending bad data

8 views
Skip to first unread message

bo...@uu3.net

unread,
Nov 22, 2010, 5:39:16 PM11/22/10
to btpd-...@googlegroups.com
Hello.

Im trying to make a patch to ignore peers that send bad data.
I modified the function dl_on_bad_piece(tp->net, piece, p)
to pass struct peer.

Now I have problem w/ peers itself. Where to hook to ignore
peer and do not send piece request for it?

I belive disconecting such peer is not a good idea,
you lose struct peer data, its just good to keep him connected
and stale.

Any suggestions?

Regards,
Borg

Nemosoft Unv.

unread,
Nov 23, 2010, 9:06:08 AM11/23/10
to btpd-...@googlegroups.com
Hello,

Well, if they keep sending bad data, disconnecting might be the best option. I
would suggest a simple counter. Initially, the counter is 0; everytime a peer
sends a bad packet increase the counter; when you receive a good packet,
decrease it, but don't go lower than 0. If the bad packet counter hits a
threshold (say, 5), disconnect them. This way the occasional bad packet won't
hurt the peer, but if they keep messing up it's bye-bye.

- Nemosoft

bo...@uu3.net

unread,
Nov 23, 2010, 9:18:28 AM11/23/10
to btpd-...@googlegroups.com
Well, if you disconnect them. you will lose struct peer
so you need extra struct to hold peer IP and ID.

peer will only send data when we request it, right?
so I rather think about some extra flag to not request
any more data from the peer and keep connection open
because it my be worth to send pieces to that peer anyway.

so I want to keep ignoring data that cames from bad peer,
send info to him that we dont want more.. and eventualy send
him our pieces (when peer is not a seed of course).

the disconnect aproach is the last thing I want to do...

---------- Original message ----------

bo...@uu3.net

unread,
Nov 25, 2010, 4:55:26 AM11/25/10
to btpd-...@googlegroups.com
Okey, I made some changes that seem will help to do what I need:
- block download from peers sending bad data
- keep them connected to us in case we can upload to them.

Unfortunetly I didnt had time yet to check it out.
If anyone with high knowledge can peek at my git repo
and put some comments..

git://borg.uu3.net/btpd.git
branch: badpeers

Unfortunetly I work w/ btpd-0.13 becase I found it very stable.

Regards,
Borg

---------- Original message ----------

Reply all
Reply to author
Forward
0 new messages