Open wen-long opened 1 year ago
yes, this would break things if it looks like every peer is coming from localhost. are you using SOCKS5?
yes, this would break things if it looks like every peer is coming from localhost. are you using SOCKS5?
http and socks5 both are effected, in my test.
I have to update this, the above report is not right
I tried to debug, but I dont know how to output log of libtorrent in qBittorrent. I modify code in start of func disconnect
void peer_connection::disconnect(error_code const& ec
, operation_t const op, disconnect_severity_t const error)
{
std::ofstream outfile;
outfile.open("/path/to/qblog.txt", std::ios_base::app); // append instead of overwrite
outfile << operation_name(op);
outfile.close();
and the log contains connect
repeatly
and I remeber I had set Network Interface
to a NIC(like en0 on mac)
thus I think below line cause the disconnection
I change Network Interface
to Any interface
then http&socks5 proxy addredd 127.0.0.1 works fine.
set Network Interface
to lo0
means disconnect from network.
maybe It's a ambiguity due to word usage. If qB setting key is literally outgoing_interfaces
, I wont change the value
I would expect that setting to correspond to listen_interfaces
setting. But if you only talk to a proxy over loopback, it seems reasonable to set that to lo0
or loopback
background
I always run a proxy in local to forward traffic, along with bittorrent. but if I set proxy address 127.0.0.1 in bittorrent(like qB), connection always be disconnected by qB, I tcpdump-ed and confirmd. thus I review code and found a bug below.
bug explain
m_remote would be proxy ip if connect peer via proxy, no wonder connection are closed.
workaround
I set proxy ip as LAN ip and it goes well.
how to fix
I think just delete these line is ok. I'm not sure if self_connection avoidance is necessary
https://github.com/arvidn/libtorrent/blob/6d64ac1dadb17df1c5719eb66179ac47e95eba12/src/peer_connection.cpp#L6335-L6339
disclaimer
Although I tested on my mac but I'didnt read too much code of libtorrent so maybe my misunderstanding.