recws icon indicating copy to clipboard operation
recws copied to clipboard

CloseAndReconnect() only Close but doesn't Reconnect

Open ZhangHanming opened this issue 3 years ago • 5 comments

// CloseAndReconnect will try to reconnect.
func (rc *RecConn) CloseAndReconnect() {
	rc.Close()
	go rc.connect()
}

the Close() function send to the close chan

rc.close <- true

connect() will return if it receives from close chan

func (rc *RecConn) connect() {
	b := rc.getBackoff()
	rand.Seed(time.Now().UTC().UnixNano())

	for {
		select {
		case <-rc.close:
			return
....

in the end calling connect() right after Close() will not work.

Am I missing something here or it is a bug?

ZhangHanming avatar Jun 30 '21 13:06 ZhangHanming

@loeffel-io Hi is this repo still actively maintained?

ZhangHanming avatar Jul 04 '21 10:07 ZhangHanming

My issue is open for more than half a year without any reaction. This repo is dead I guess :sad:

masseelch avatar Aug 11 '21 08:08 masseelch

hey guys, its not dead - just have no time for it rn - PRs are welcome :-)

loeffel-io avatar Aug 11 '21 18:08 loeffel-io

hey guys, its not dead - just have no time for it rn - PRs are welcome :-)

Glad to hear :-)

masseelch avatar Aug 11 '21 18:08 masseelch

hey guys, its not dead - just have no time for it rn - PRs are welcome :-)

@loeffel-io Hi Please verify if the stated behaviour is possible at least. Then people can work around it before a fix. thank you

ZhangHanming avatar Oct 31 '21 06:10 ZhangHanming