diff options
| author | lijia <[email protected]> | 2021-10-09 16:11:38 +0800 |
|---|---|---|
| committer | lijia <[email protected]> | 2021-10-09 16:11:38 +0800 |
| commit | 2dda42342fad6818af3618a264a5775ffb2af17d (patch) | |
| tree | b51657d174804d3894b78d2ae9e4988256ded877 /test | |
| parent | 90ce47ab5c82067de4b7559bb69cb9aa7d5285e6 (diff) | |
TSG-7425, TSG-7978,
修复sapp退出时未释放的内存.
增加breakpad_destroy()接口;
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_app_sapp.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/test/test_app_sapp.c b/test/test_app_sapp.c index 71126b2..a9f40f0 100644 --- a/test/test_app_sapp.c +++ b/test/test_app_sapp.c @@ -22,6 +22,7 @@ typedef struct{ char str_value2[NAME_MAX]; int test_project_id; + int test_bridge_id; }test_app_val_t; /* ����һЩȫ�ֱ���, �и��ֲ�ͬ������, ��������������ݲ���, @@ -2661,6 +2662,57 @@ char test_get_rawpkt_opt_from_streaminfo(struct streaminfo *f_stream,unsigned ch return APP_STATE_GIVEME; } + +static void __stream_bridge_free_cb(const struct streaminfo *stream, int bridge_id, void *data) +{ + free(data); +} + +char stream_bridge_tcp_entry(struct streaminfo *pstream,void **pme, int thread_seq,const void *a_packet) +{ + int bridge_id; + + bridge_id = stream_bridge_build("test_bridge", "r"); + if(bridge_id < 0){ + printf("##### stream_bridge_tcp_entry(): stream_bridge_build error!\n"); + return APP_STATE_DROPME; + } + + if(OP_STATE_CLOSE == pstream->opstate){ + /* tcp�Ƚ���, �������� */ + void *data = calloc(1, 100); + strncpy(data, "abcdefg1234567", 100); + stream_bridge_async_data_put(pstream, bridge_id, data); + printf("##### tcp entry bridge put data:%s\n", data); + } + + return APP_STATE_GIVEME; +} + +char stream_bridge_tcpall_entry(struct streaminfo *pstream,void **pme, int thread_seq,const void *a_packet) +{ + int bridge_id; + + bridge_id = stream_bridge_build("test_bridge", "r"); + if(bridge_id < 0){ + printf("##### stream_bridge_tcpall_entry(): stream_bridge_build error!\n"); + return APP_STATE_DROPME; + } + + if(OP_STATE_CLOSE == pstream->pktstate){ + char *data; + data = (char *)stream_bridge_async_data_get(pstream, bridge_id); + if(data){ + printf("tcpall entry bridge get:%s\n", data); + }else{ + printf("tcpall entry bridge get data error\n"); + } + } + + return APP_STATE_GIVEME; +} + + char UDP_ENTRY(struct streaminfo *a_tcp, void **pme, int thread_seq,void *a_packet) { //test_project_add(a_tcp,pme,thread_seq,a_packet); @@ -3365,6 +3417,16 @@ int CHAR_INIT() /* �������ڳ�ʼ��ʱ����ע��project */ g_test_app_val.test_project_id = project_producer_register("test_project", "struct", __fake_project_free_cb); + if(g_test_app_val.test_project_id < 0){ + printf("##### project_producer_register error!\n"); + return -1; + } + g_test_app_val.test_bridge_id = stream_bridge_build("test_bridge", "w"); + if(g_test_app_val.test_bridge_id < 0){ + printf("##### stream_bridge_build error!\n"); + return -1; + } + stream_bridge_register_data_free_cb(g_test_app_val.test_bridge_id, __stream_bridge_free_cb); return 1; } |
