!101 [sync] PR-97: 申请socket失败时,清理sock资源
From: @openeuler-sync-bot Reviewed-by: @wu-changsheng Signed-off-by: @wu-changsheng
This commit is contained in:
commit
add5e4ed06
39
0033-alloc-socket-fail-clean-sock.patch
Normal file
39
0033-alloc-socket-fail-clean-sock.patch
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
From fc2a5b52f7d9f02eb43931414767635e5cf4c8c1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: jiangheng <jiangheng14@huawei.com>
|
||||||
|
Date: Tue, 11 Oct 2022 21:47:24 +0800
|
||||||
|
Subject: [PATCH] alloc socket fail clean sock
|
||||||
|
|
||||||
|
---
|
||||||
|
src/api/sockets.c | 3 +++
|
||||||
|
src/include/lwipsock.h | 1 +
|
||||||
|
2 files changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||||
|
index 14f2b35..3552599 100644
|
||||||
|
--- a/src/api/sockets.c
|
||||||
|
+++ b/src/api/sockets.c
|
||||||
|
@@ -598,6 +598,9 @@ alloc_socket(struct netconn *newconn, int accepted)
|
||||||
|
sockets[i].sendevent = (NETCONNTYPE_GROUP(newconn->type) == NETCONN_TCP ? (accepted != 0) : 1);
|
||||||
|
sockets[i].errevent = 0;
|
||||||
|
return i + LWIP_SOCKET_OFFSET;
|
||||||
|
+ } else {
|
||||||
|
+ lwip_close(i);
|
||||||
|
+ gazelle_clean_sock(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
err:
|
||||||
|
diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h
|
||||||
|
index 912d471..2ffb077 100644
|
||||||
|
--- a/src/include/lwipsock.h
|
||||||
|
+++ b/src/include/lwipsock.h
|
||||||
|
@@ -130,6 +130,7 @@ extern void add_recv_list(int32_t fd);
|
||||||
|
extern ssize_t read_lwip_data(struct lwip_sock *sock, int32_t flags, u8_t apiflags);
|
||||||
|
extern struct pbuf *write_lwip_data(struct lwip_sock *sock, uint16_t remain_size, uint8_t *apiflags);
|
||||||
|
extern void gazelle_init_sock(int32_t fd);
|
||||||
|
+extern void gazelle_clean_sock(int32_t fd);
|
||||||
|
extern void write_lwip_over(struct lwip_sock *sock, uint32_t n);
|
||||||
|
#endif /* USE_LIBOS */
|
||||||
|
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
@ -4,7 +4,7 @@
|
|||||||
Summary: lwip is a small independent implementation of the TCP/IP protocol suite
|
Summary: lwip is a small independent implementation of the TCP/IP protocol suite
|
||||||
Name: lwip
|
Name: lwip
|
||||||
Version: 2.1.3
|
Version: 2.1.3
|
||||||
Release: 20
|
Release: 21
|
||||||
License: BSD
|
License: BSD
|
||||||
URL: http://savannah.nongnu.org/projects/lwip/
|
URL: http://savannah.nongnu.org/projects/lwip/
|
||||||
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.tar.gz
|
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.tar.gz
|
||||||
@ -44,6 +44,7 @@ Patch9028: 0029-fix-EISCONN-err-and-remove-same-customized-modificat.patch
|
|||||||
Patch9029: 0030-refactor-tcp-new-port.patch
|
Patch9029: 0030-refactor-tcp-new-port.patch
|
||||||
Patch9030: 0031-refactor-add-event-limit-send-pkts-num.patch
|
Patch9030: 0031-refactor-add-event-limit-send-pkts-num.patch
|
||||||
Patch9031: 0032-fix-free-pbuf-miss-data.patch
|
Patch9031: 0032-fix-free-pbuf-miss-data.patch
|
||||||
|
Patch9032: 0033-alloc-socket-fail-clean-sock.patch
|
||||||
|
|
||||||
BuildRequires: gcc-c++ dos2unix dpdk-devel
|
BuildRequires: gcc-c++ dos2unix dpdk-devel
|
||||||
|
|
||||||
@ -72,6 +73,9 @@ cd %{_builddir}/%{name}-%{version}/src
|
|||||||
%{_libdir}/liblwip.a
|
%{_libdir}/liblwip.a
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Oct 11 2022 wuchangsheng<wuchangsheng2@huawei.com> - 2.1.3-21
|
||||||
|
- alloc socket fail clean sock
|
||||||
|
|
||||||
* Thu Oct 6 2022 wuchangsheng<wuchangsheng2@huawei.com> - 2.1.3-20
|
* Thu Oct 6 2022 wuchangsheng<wuchangsheng2@huawei.com> - 2.1.3-20
|
||||||
- fix miss data due to free pbuf
|
- fix miss data due to free pbuf
|
||||||
close debug
|
close debug
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user