Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why "connectedFlag" not set zero when Stop() called #291

Closed
TT6033 opened this issue Mar 20, 2020 · 2 comments
Closed

why "connectedFlag" not set zero when Stop() called #291

TT6033 opened this issue Mar 20, 2020 · 2 comments
Labels

Comments

@TT6033
Copy link

TT6033 commented Mar 20, 2020

connectedFlag =1 when ConnectToNSQLookupd called
why "connectedFlag" not set zero when Stop() called?

@ploxiln
Copy link
Member

ploxiln commented Mar 20, 2020

... just because it wasn't needed. It is only used in one place, to ensure that handlers are not added after starting connections:

func (r *Consumer) AddConcurrentHandlers(handler Handler, concurrency int) {
	if atomic.LoadInt32(&r.connectedFlag) == 1 {
		panic("already connected")
	}

It is assumed that after Stop() the process will exit, or will create a new Consumer when needed again.

@TT6033
Copy link
Author

TT6033 commented Mar 24, 2020

It is only used twice....because some Strange reason.
I think it should be reset when stop the connection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants