Closed abarisani closed 7 years ago
Hi,
I'll look into this (I have not used StopListening() myself) How are your goroutines calling Start/Stop listening?
We hold a single instance of *textsecure.Client and call its StartListening()/StopListening() without goroutines involved.
The scenario is a synchronous Start/Stop/Start sequence.
Thanks!
So only calling StopListening when StartListening has exited it's for loop? Is StartListening() returning the error?
We don't know if/when StartListening has exited the loop.
This is the core issue here, we want to stop/start at will but there seems to be no way to cleanly do this. One would expect that StopListening() could be invoked after StartListening() to have it exit the loop, instead this doesn't happen cleanly as the errors I pasted suggest.
The errors are not given directly by StartListening() or StopListening() which both exist cleanly after invocation.
I hope this helps.
If there are no goroutines how do you run StopListening before StartListening exited? Is there a simplified test app that can reproduce the issue?
Ah, you are right. Sorry for that, I do indeed start in a goroutine (and that is the only one involved):
// stuff
go func() { textsecure.StartListening() }
// stuff
textsecure.StopListening()
What is the best approach/hook to call StopListening() safely ?
Thanks
Hello,
we are using your library on a running instance and we require to stop/start the listener at will, by re-using the same client (or even allocating new ones), we stumble upon the following issue on quick re-connections:
ERRO[2016/04/13 14:34:48] EOF
ERRO[2016/04/13 14:34:48] read tcp 192.168.0.101:59546->52.7.8.191:443: use of closed network connection ERRO[2016/04/13 14:35:03] crypto/tls: use of closed connection
I haven't pin pointed what is responsible for this but surely the following goroutine:
go wsconn.keepAlive()
maybe should not be started every time StartListening() is invoked as it's never cleaned up by StopListening().
However I don't think this is the cause of the error message given that we can't receive messages once the condition happens.
Do you have any suggestions on what my be the culprit here and how it can be fixed?
Thanks