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

Channel 类的 isEmpty 方法逻辑错误 #5

Open
zither opened this issue Nov 24, 2020 · 0 comments
Open

Channel 类的 isEmpty 方法逻辑错误 #5

zither opened this issue Nov 24, 2020 · 0 comments

Comments

@zither
Copy link

zither commented Nov 24, 2020

//php_channel.c#L148
/**
 * 通道是否为空
 */
PHP_METHOD(workerman_channel, isEmpty) {
	wmChannelObject *chan_t;
	wmChannel *chan;
	chan_t = (wmChannelObject*) wmChannel_fetch_object(Z_OBJ_P(getThis()));
	chan = chan_t->chan;
	int num = wmChannel_num(chan);
	bool is_exist = (num > 0);                 //实际判断的是 channel 非空
	RETURN_BOOL(is_exist);
}

该方法实际逻辑和名字完全相反。

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

No branches or pull requests

1 participant