From b531617b28cddad3d194091e0de2f92541be44a9 Mon Sep 17 00:00:00 2001 From: liuxueli Date: Sun, 26 Sep 2021 11:20:34 +0800 Subject: TSG-7908: FS2报错但不影响功能 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MESA_field_stat.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/MESA_field_stat.cpp b/src/MESA_field_stat.cpp index 0228ce1..fd5034c 100644 --- a/src/MESA_field_stat.cpp +++ b/src/MESA_field_stat.cpp @@ -152,12 +152,16 @@ static int send_udp(int sd, unsigned int dest_ip, unsigned short dest_port, cons } void flush_metric(struct FS_space_t* _handle) { - if(_handle->snd_buf_off==0 || _handle->server_port==0) + if(_handle->snd_buf_off==0) { return; } - send_udp(_handle->statsd_socket, _handle->server_ip,(unsigned short) _handle->server_port, - _handle->send_buff, _handle->snd_buf_off); + + if(_handle->server_port>0) + { + send_udp(_handle->statsd_socket, _handle->server_ip,(unsigned short) _handle->server_port, _handle->send_buff, _handle->snd_buf_off); + } + _handle->snd_buf_off=0; memset(_handle->send_buff,0,sizeof(_handle->send_buff)); return; -- cgit v1.2.3