diff options
| author | Lu Qiuwen <[email protected]> | 2023-10-30 18:50:01 +0800 |
|---|---|---|
| committer | Lu Qiuwen <[email protected]> | 2023-10-30 18:50:01 +0800 |
| commit | c49cdd6dcab6572287efbdb1f97e4d33b2012ca6 (patch) | |
| tree | f8b986868f9df47d44d7e0edb648b513bc1b56f3 /app/src/monit.c | |
| parent | a2cb9faeaf0089f37d91a33af15d4476ee34d034 (diff) | |
bugfix: fix the crash problem when the app opens a tx only virtual device.v4.6.59-20231030
Diffstat (limited to 'app/src/monit.c')
| -rw-r--r-- | app/src/monit.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/app/src/monit.c b/app/src/monit.c index ff474fd..3be3ce3 100644 --- a/app/src/monit.c +++ b/app/src/monit.c @@ -11,10 +11,22 @@ unsigned int g_monit_interval = 1; int vdev_instance_stats_get(struct vdev_instance * vdi, struct vdev_stat_info * stat_info) { - struct vnode_cons_stat * st_cons_rx = vnode_mirror_cons_stat_get(vdi->vnode_rx_cons); - struct vnode_prod_stat * st_prod_tx = vnode_mirror_prod_stat_get(vdi->vnode_tx_prod); - struct vnode_prod_stat * st_prod_ftx = vnode_mirror_prod_stat_get(vdi->vnode_ftx_prod); - struct vnode_prod_stat * st_prod_ltx = vnode_mirror_prod_stat_get(vdi->vnode_ltx_prod); + struct vnode_cons_stat * st_cons_rx = NULL; + struct vnode_prod_stat * st_prod_tx = NULL; + struct vnode_prod_stat * st_prod_ftx = NULL; + struct vnode_prod_stat * st_prod_ltx = NULL; + + if(vdi->nr_rxstream > 0) + { + st_cons_rx = vnode_mirror_cons_stat_get(vdi->vnode_rx_cons); + } + + if(vdi->nr_txstream > 0) + { + st_prod_tx = vnode_mirror_prod_stat_get(vdi->vnode_tx_prod); + st_prod_ftx = vnode_mirror_prod_stat_get(vdi->vnode_ftx_prod); + st_prod_ltx = vnode_mirror_prod_stat_get(vdi->vnode_ltx_prod); + } stat_info->nr_rxstream = vdi->nr_rxstream; stat_info->nr_txstream = vdi->nr_txstream; |
