: BitTorrent is a peer-to-peer (p2p) protocol for file-sharing. Its improvement over other file-sharing protocols is its tit-for-tat strategy to decide to whom a peer should upload. This means that an upload to a peer depends on the download from that peer. This paper investigates the BitTorrent upload algorithm and proposes a new algorithm which is based on a distributed optimisation problem where each peer maximises its own revenue. First simulation results show that the proposed algorithm outperforms the BitTorrent choking algorithm with respect to efficiency and fairness.