工匠老王: static void thread_function(void *param) { struct mg_connection *c = param; mg_http_write_chunk(c, "chunk test", 10); mg_usleep(2 * 1000000); mg_mgr_wakeup(c); } static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) { if (ev == MG_EV_HTTP_MSG) { struct mg_http_message *hm = (struct mg_http_message *) ev_data; if (mg_http_match_uri(hm, "/fast.flv")) { // Multithreading code path //doing 略 http头 c->label[0] = 'W'; start_thread(thread_function, fn_data); } } } static void pcb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) { if (ev == MG_EV_READ) { struct mg_connection *t; for (t = c->mgr->conns; t != NULL; t = t->next) { if (t->label[0] != 'W') continue; mg_http_write_chunk(c, "chunk test", 10); mg_http_reply(t, 200, "Host: foo.com\r\n", "hi\n"); t->label[0] = 0; } } } 博主,请教个问题,7.4版本中在线程函数中返回chunk数据抓包的话是没有的,pcb函数回调返回chunk是可以返回的。如果想实现在线程函数中while不停返回chunk我该如何处理?谢谢了
【0278】checkpointer 共享内存(CheckpointerShmem)初始化(3)
【015】 mongoose V7.4源码剖析之HTTP特定协议回调函数