mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-12 05:58:15 -04:00
get_socket returns a reference
This commit is contained in:
parent
849a269fde
commit
2a85cdccce
@ -56,7 +56,7 @@ bool has_handle(size_t fd);
|
||||
void release_handle(size_t fd);
|
||||
|
||||
size_t register_new_socket(network::socket_domain domain, network::socket_type type, network::socket_protocol protocol);
|
||||
const network::socket& get_socket(size_t fd);
|
||||
network::socket& get_socket(size_t fd);
|
||||
bool has_socket(size_t fd);
|
||||
void release_socket(size_t fd);
|
||||
|
||||
|
@ -918,7 +918,7 @@ const path& scheduler::get_handle(size_t fd){
|
||||
size_t scheduler::register_new_socket(network::socket_domain domain, network::socket_type type, network::socket_protocol protocol){
|
||||
auto id = pcb[current_pid].sockets.size();
|
||||
|
||||
pcb[current_pid].sockets.emplace_back(id, domain, type, protocol);
|
||||
pcb[current_pid].sockets.emplace_back(id, domain, type, protocol, 1);
|
||||
|
||||
return id;
|
||||
}
|
||||
@ -931,7 +931,7 @@ bool scheduler::has_socket(size_t fd){
|
||||
return fd < pcb[current_pid].sockets.size() && pcb[current_pid].sockets[fd].is_valid();
|
||||
}
|
||||
|
||||
const network::socket& scheduler::get_socket(size_t fd){
|
||||
network::socket& scheduler::get_socket(size_t fd){
|
||||
return pcb[current_pid].sockets[fd];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user