Currently, A and B are transferring files 1:1. I'm trying to run code that disconnects the torrent from B.
Using the codes introduced at https://www.npmjs.com/package/bittorrent-protocol I tried to disconnect the current connection using
wire.choke()
wire.uninterested()
However, the file is still being transferred. I wonder why it doesn't work as intended.
There is no explicit shutdown signalling on the bittorrent layer. To disconnect a bittorrent peer you have to close the underlying TCP connection.