summaryrefslogtreecommitdiffstats
path: root/src/vcl/ldp.c
diff options
context:
space:
mode:
authorliuyacan <liuyacan@corp.netease.com>2021-06-13 14:54:55 +0800
committerFlorin Coras <florin.coras@gmail.com>2021-06-14 14:35:04 +0000
commit55c952ed5f56a1a478f03f8458e82530478c4359 (patch)
tree43198873060cc8b36cda93995a2f4e56810e87ff /src/vcl/ldp.c
parent89d939e52c999edec66194c60bc5afb2397a2842 (diff)
vcl: improve shutdown()
This commit does following: - Change the behavior of shutdown() with SHUT_RDWR flag. - Check SHUT_RD flag when read() - Change the errno when write() after SHUT_WR - Remove unused code All the above modification passed the packetdrill test. Type: improvement Signed-off-by: liuyacan <liuyacan@corp.netease.com> Change-Id: I0c81f52e563562e58580d70976526b898e65e915
Diffstat (limited to 'src/vcl/ldp.c')
-rw-r--r--src/vcl/ldp.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c
index b51d2e0ebb4..54a8f66354f 100644
--- a/src/vcl/ldp.c
+++ b/src/vcl/ldp.c
@@ -2175,8 +2175,7 @@ int
shutdown (int fd, int how)
{
vls_handle_t vlsh;
- int rv = 0, flags;
- u32 flags_len = sizeof (flags);
+ int rv = 0;
ldp_init_check ();
@@ -2184,23 +2183,7 @@ shutdown (int fd, int how)
if (vlsh != VLS_INVALID_HANDLE)
{
LDBG (0, "called shutdown: fd %u vlsh %u how %d", fd, vlsh, how);
-
- if (vls_attr (vlsh, VPPCOM_ATTR_SET_SHUT, &how, &flags_len))
- {
- close (fd);
- return -1;
- }
-
- if (vls_attr (vlsh, VPPCOM_ATTR_GET_SHUT, &flags, &flags_len))
- {
- close (fd);
- return -1;
- }
-
- if (flags == SHUT_RDWR)
- rv = close (fd);
- else if (flags == SHUT_WR)
- rv = vls_shutdown (vlsh);
+ rv = vls_shutdown (vlsh, how);
}
else
{