All pastes #986551 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-04-15 21:47 UTC
rendered paste body
Structures:
peerID - contains IP, passkey, uploaded_reported, download_reported, upload_accurate, download_accurate
torrentID - contains torrent hash/DB ID (whichever is faster), total_uploaded, total_downloaded (totals for transfer_check.c)

Source files:
socket_listen.c listens for connections, creates/updates peer instance for each peer, sends peer id to send_peer.c, sends peer id to transfer_check.c
send_peer.c calls get_peer_table.getPeerList(torrent ID) and sends it to the new peer

peer_table.c - contains getPeerList(torrent ID) which returns a list of peers for given torrent, addPeer(torrent ID, peer ID), removePeer(torrent ID, peer ID)

transfer_check.c - runs peer transfer checking and other cheat detection methods (yet to be determined haha) to determine for cheating and actual stats, then peer ID with  accurate stats to update_stats; if blatant cheating is detected (upload_reported > total_uploaded, etc.) calls cheater.reportCheater(peerID)
cheater.c - reports a cheater to a MySQL table or other method, depending on implementation

update_stats.c - updates MySQL database based