MCPcopy Create free account
hub / github.com/acl-dev/acl / acl_fiber_socket

Function acl_fiber_socket

lib_fiber/c/src/hook/socket.c:8–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include "hook.h"
7
8socket_t WINAPI acl_fiber_socket(int domain, int type, int protocol)
9{
10 socket_t sockfd;
11
12 if (sys_socket == NULL) {
13 hook_once();
14 if (sys_socket == NULL) {
15 return -1;
16 }
17 }
18
19 sockfd = (*sys_socket)(domain, type, protocol);
20
21 if (!var_hook_sys_api) {
22 return sockfd;
23 }
24
25#if 0
26 /* We shouldn't set NON_BLOCKING where because the NON_BLOCKING will
27 * be checked in acl_fiber_connect(). -- zsx, 2022.01.21
28 */
29 if (sockfd != INVALID_SOCKET) {
30 non_blocking(sockfd, NON_BLOCKING);
31 } else {
32 fiber_save_errno(acl_fiber_last_error());
33 }
34#else
35 if (sockfd == INVALID_SOCKET) {
36 fiber_save_errno(acl_fiber_last_error());
37 } else {
38 FILE_EVENT *fe = fiber_file_open(sockfd);
39 file_event_init(fe, sockfd);
40 }
41#endif
42
43 return sockfd;
44}
45
46int WINAPI acl_fiber_listen(socket_t sockfd, int backlog)
47{

Callers 4

runMethod · 0.85
runMethod · 0.85
udp_requestFunction · 0.85
socketFunction · 0.85

Calls 6

hook_onceFunction · 0.85
non_blockingFunction · 0.85
acl_fiber_last_errorFunction · 0.85
fiber_file_openFunction · 0.85
file_event_initFunction · 0.85
fiber_save_errnoFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…