Skip to content

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

Description

@zither
//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);
}

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions