mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
file: call shutdown on socket close
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
#include <logging.h>
|
#include <logging.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <kernel/alloc.h>
|
#include <kernel/alloc.h>
|
||||||
|
#include <kernel/sock.h>
|
||||||
|
|
||||||
static scache_t *filecache;
|
static scache_t *filecache;
|
||||||
#define FILE_HOLD(f) __atomic_add_fetch(&(f)->refcount, 1, __ATOMIC_SEQ_CST)
|
#define FILE_HOLD(f) __atomic_add_fetch(&(f)->refcount, 1, __ATOMIC_SEQ_CST)
|
||||||
@@ -179,6 +180,11 @@ int fd_close(int fd) {
|
|||||||
MUTEX_RELEASE(&proc->fdmutex);
|
MUTEX_RELEASE(&proc->fdmutex);
|
||||||
|
|
||||||
if (file) {
|
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);
|
FILE_RELEASE(file);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
name=astral
|
name=astral
|
||||||
revision=21
|
revision=22
|
||||||
from_source=astral
|
from_source=astral
|
||||||
imagedeps="build-essential nasm"
|
imagedeps="build-essential nasm"
|
||||||
hostdeps="xgcc xbinutils limine"
|
hostdeps="xgcc xbinutils limine"
|
||||||
|
|||||||
Reference in New Issue
Block a user