mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-30 05:58:22 +00:00
socket: fix close shutdown properly
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
#include <logging.h>
|
||||
#include <errno.h>
|
||||
#include <kernel/alloc.h>
|
||||
#include <kernel/sock.h>
|
||||
|
||||
static scache_t *filecache;
|
||||
#define FILE_HOLD(f) __atomic_add_fetch(&(f)->refcount, 1, __ATOMIC_SEQ_CST)
|
||||
@@ -180,11 +179,6 @@ int fd_close(int fd) {
|
||||
MUTEX_RELEASE(&proc->fdmutex);
|
||||
|
||||
if (file) {
|
||||
if (file->vnode && file->vnode->type == V_TYPE_SOCKET) {
|
||||
socket_t *socket = SOCKFS_SOCKET_FROM_NODE(file->vnode);
|
||||
socket->ops->shutdown(socket, SOCKET_SHUTDOWN_RW);
|
||||
}
|
||||
|
||||
FILE_RELEASE(file);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -22,7 +22,9 @@ int sockfs_open(vnode_t **node, int flags, cred_t *cred) {
|
||||
}
|
||||
|
||||
int sockfs_close(vnode_t *node, int flags, cred_t *cred) {
|
||||
return ENOSYS; // not needed
|
||||
socket_t *socket = SOCKFS_SOCKET_FROM_NODE(node);
|
||||
|
||||
return socket->ops->shutdown ? socket->ops->shutdown(socket, SOCKET_SHUTDOWN_RW) : 0;
|
||||
}
|
||||
|
||||
int sockfs_read(vnode_t *node, iovec_iterator_t *iovec_iterator, size_t size, uintmax_t offset, int flags, size_t *bytes_read, cred_t *cred) {
|
||||
|
||||
Reference in New Issue
Block a user