Mosquitto-1.5.4源码,主题订阅的数据结构

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/libaineu2004/article/details/84935825

/src/database.c

int db__open(struct mosquitto__config *config, struct mosquitto_db *db)
{
	struct mosquitto__subhier *subhier;

	if(!config || !db) return MOSQ_ERR_INVAL;

	db->last_db_id = 0;

	db->contexts_by_id = NULL;
	db->contexts_by_sock = NULL;
	db->contexts_for_free = NULL;
#ifdef WITH_BRIDGE
	db->bridges = NULL;
	db->bridge_count = 0;
#endif

	// Initialize the hashtable
	db->clientid_index_hash = NULL;

	db->subs = NULL;

    subhier = sub__add_hier_entry(NULL, &db->subs, "", strlen(""));//业务子树根节点
	if(!subhier) return MOSQ_ERR_NOMEM;

    subhier = sub__add_hier_entry(NULL, &db->subs, "$SYS", strlen("$SYS"));//系统子树根节点
	if(!subhier) return MOSQ_ERR_NOMEM;

猜你喜欢

转载自blog.csdn.net/libaineu2004/article/details/84935825