!32 客户端主动断链,服务端错只会清理index 0的资源

From: @xu-chongyu214 
Reviewed-by: @queyanwen 
Signed-off-by: @queyanwen
This commit is contained in:
openeuler-ci-bot 2023-12-27 09:31:46 +00:00 committed by Gitee
commit 18a00c0489
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 42 additions and 4 deletions

36
powerapi-0.patch Normal file
View File

@ -0,0 +1,36 @@
From cd6bd63738ea2abb5ac953e976fca6d1cfcbd545 Mon Sep 17 00:00:00 2001
From: queyanwen <queyanwen@huawei.com>
Date: Wed, 27 Dec 2023 15:43:28 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E8=A7=A3=E5=86=B3=E9=97=AE=E9=A2=98?=
=?UTF-8?q?=EF=BC=9A=E6=88=B7=E7=AB=AF=E4=B8=BB=E5=8A=A8=E6=96=AD=E9=93=BE?=
=?UTF-8?q?=EF=BC=8C=E6=9C=8D=E5=8A=A1=E7=AB=AF=E9=94=99=E5=8F=AA=E4=BC=9A?=
=?UTF-8?q?=E6=B8=85=E7=90=86index=200=E7=9A=84=E8=B5=84=E6=BA=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pwrapis/src/server.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pwrapis/src/server.c b/pwrapis/src/server.c
index b3f3fa6..1a1767b 100644
--- a/pwrapis/src/server.c
+++ b/pwrapis/src/server.c
@@ -230,10 +230,10 @@ static void AcceptConnection(void)
Logger(INFO, MD_NM_SVR, "Create new connection succeed. fd:%d, sysId:%d", client.fd, client.sysId);
}
-static void CleanClientResource(PwrClient *pwrClient, int idx)
+static void CleanClientResource(PwrClient clients[], int idx)
{
- CleanControlAuth(pwrClient->sysId);
- CleanDataCollTaskByClient(pwrClient->sysId);
+ CleanControlAuth(clients[idx].sysId);
+ CleanDataCollTaskByClient(clients[idx].sysId);
DeleteFromClientList(g_pwrClients, idx);
}
--
Gitee

Binary file not shown.

View File

@ -1,11 +1,12 @@
Name: powerapi
Version: 1.0.1
Release: 1
Release: 2
Summary: The ability to support openEuler power consumption control.
License: MulanPSL-2.0
URL: https://gitee.com/openeuler/powerapi/
Source0: %{name}-%{version}.tar.gz
Patch0: powerapi-0.patch
BuildRequires: gcc,cmake,zip,unzip
@ -20,13 +21,11 @@ BuildRequires: gcc,cmake,zip,unzip
Contains the client and server components and API header files for powerapi integration development.
%prep
%autosetup
%autosetup -p1
%build
sh build.sh release
%install
install -d %{buildroot}/%{_sysconfdir}/sysconfig/pwrapis
cp release/pwrapis/conf/pwrapis_config.ini %{buildroot}/%{_sysconfdir}/sysconfig/pwrapis
@ -68,6 +67,9 @@ systemctl stop pwrapis
%{_sysconfdir}/systemd/system/pwrapis.service
%changelog
* Wed Dec 27 2023 xuchongyu <xuchongyu@huawei.com> - 1.0.1-2
- Solve the problem that the client is actively disconnected and the server is incorrect in clearing resources
* Sat Dec 23 2023 queyanwen <queyanwen@huawei.com> - 1.0.1-1
- Change the version number for the first releasing