diff options
| author | wangmenglan <[email protected]> | 2023-06-05 13:57:16 +0800 |
|---|---|---|
| committer | wangmenglan <[email protected]> | 2023-06-05 17:20:19 +0800 |
| commit | 409dfb7e4b785d8f93d28d00dfbecc4f07d63ac1 (patch) | |
| tree | 9e0c237bd9074edd88fb1b21eb42c967c81d0ea9 /common/src/tfe_cmsg.cpp | |
| parent | 4d262813384164aa139871be504fdf68ed8dcc3b (diff) | |
🐞 fix: 调整TFE conf 文件, 使用四元组分流; 调整metric接口调用位置
Diffstat (limited to 'common/src/tfe_cmsg.cpp')
| -rw-r--r-- | common/src/tfe_cmsg.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/common/src/tfe_cmsg.cpp b/common/src/tfe_cmsg.cpp index a7e0969..6b03716 100644 --- a/common/src/tfe_cmsg.cpp +++ b/common/src/tfe_cmsg.cpp @@ -52,20 +52,20 @@ struct tfe_cmsg* tfe_cmsg_init() return cmsg; } -void tfe_cmsg_destroy(struct tfe_cmsg *cmsg) +void tfe_cmsg_destroy(struct tfe_cmsg **cmsg) { - if(cmsg != NULL) + if(*cmsg != NULL) { - if ((__sync_sub_and_fetch(&cmsg->ref, 1) != 0)) + if ((__sync_sub_and_fetch(&((*cmsg)->ref), 1) != 0)) return; - pthread_rwlock_wrlock(&cmsg->rwlock); + pthread_rwlock_wrlock(&((*cmsg)->rwlock)); for(int i = 0; i < TFE_CMSG_TLV_NR_MAX; i++) { - FREE(&(cmsg->tlvs[i])); + FREE(&((*cmsg)->tlvs[i])); } - pthread_rwlock_unlock(&cmsg->rwlock); - pthread_rwlock_destroy(&cmsg->rwlock); - FREE(&cmsg); + pthread_rwlock_unlock(&((*cmsg)->rwlock)); + pthread_rwlock_destroy(&((*cmsg)->rwlock)); + FREE(cmsg); } } @@ -296,6 +296,6 @@ int tfe_cmsg_deserialize(const unsigned char *data, uint16_t len, struct tfe_cms return 0; error_out: - tfe_cmsg_destroy(cmsg); + tfe_cmsg_destroy(&cmsg); return TFE_CMSG_INVALID_FORMAT; } |
