diff options
author | irungentoo <irungentoo@gmail.com> | 2013-08-14 10:26:02 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-08-14 10:26:02 -0400 |
commit | 5909a13ba417733d14c3f88b79f7ec60faa8cbbf (patch) | |
tree | 9dd92ca3126f37458e0d396df803a3795d171d2c | |
parent | 8eb8fb2ab5f703388be8987fd6b2cdf9dbc567e9 (diff) |
Add friend now fails if it already is in DHT.
-rw-r--r-- | core/DHT.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -633,6 +633,8 @@ static int handle_sendnodes(IP_Port source, uint8_t * packet, uint32_t length) | |||
633 | 633 | ||
634 | int DHT_addfriend(uint8_t * client_id) | 634 | int DHT_addfriend(uint8_t * client_id) |
635 | { | 635 | { |
636 | if(friend_number(client_id) != -1) /*Is friend already in DHT?*/ | ||
637 | return 1; | ||
636 | Friend * temp; | 638 | Friend * temp; |
637 | temp = realloc(friends_list, sizeof(Friend) * (num_friends + 1)); | 639 | temp = realloc(friends_list, sizeof(Friend) * (num_friends + 1)); |
638 | if (temp == NULL) | 640 | if (temp == NULL) |