You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I implemented a class torsocket to replace socket for P2P communication.
It works in principle, but of 1000 attempts for connection I might have one successful send/recv and 999 TimeOutErrors.
class Torsocket:
def __init__(self,ip,port):
self.mgr1 = TorClient()
self.tor = type(self.mgr1).__enter__(self.mgr1)
self.mgr2 = self.tor.create_circuit(3)
self.circuit = type(self.mgr2).__enter__(self.mgr2)
self.mgr3 = self.circuit.create_stream((ip,port))
self.stream = type(self.mgr3).__enter__(self.mgr3)
def send(self,data):
self.stream.send(data)
def recv(self,size):
return self.stream.recv(size)
def __del__(self):
for bla in [self.mgr3,self.mgr2,self.mgr1]: type(bla).__exit__(bla, None, None, None)
Imagine an arbitrary software, replacing the two lines
And the code works perfect before the replacement into torsocket.
What could be the source of the time-out-error then?
Also, how large is the network? Is your package creating a connection to the entire TOR network of the TOR project?
Or is this code building and residing on its own little twin? Because that might explain the issue.
The text was updated successfully, but these errors were encountered:
I implemented a class torsocket to replace socket for P2P communication.
It works in principle, but of 1000 attempts for connection I might have one successful send/recv and 999 TimeOutErrors.
Imagine an arbitrary software, replacing the two lines
with the one-liner
And the code works perfect before the replacement into torsocket.
What could be the source of the time-out-error then?
Also, how large is the network? Is your package creating a connection to the entire TOR network of the TOR project?
Or is this code building and residing on its own little twin? Because that might explain the issue.
The text was updated successfully, but these errors were encountered: