MCPcopy Create free account
hub / github.com/F-Stack/f-stack / setsockopt

Function setsockopt

adapter/micro_thread/mt_sys_hook.cpp:282–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280}
281
282int setsockopt(int fd, int level, int option_name, const void *option_value, socklen_t option_len)
283{
284 mt_hook_syscall(setsockopt);
285 MtHookFd* hook_fd = mt_hook_find_fd(fd);
286 if (!mt_hook_active() || !hook_fd || !ff_hook_active())
287 {
288 return mt_real_func(setsockopt)(fd, level, option_name, option_value, option_len);
289 }
290
291 if (SOL_SOCKET == level)
292 {
293 struct timeval *val = (struct timeval*)option_value;
294 if (SO_RCVTIMEO == option_name)
295 {
296 hook_fd->read_timeout = val->tv_sec * 1000 + val->tv_usec / 1000;
297 }
298 else if (SO_SNDTIMEO == option_name)
299 {
300 hook_fd->write_timeout = val->tv_sec * 1000 + val->tv_usec / 1000;
301 }
302 }
303
304 return ff_hook_setsockopt(fd, level, option_name, option_value, option_len);
305}
306
307int fcntl(int fd, int cmd, ...)
308{

Callers 2

CreateSockMethod · 0.70
loopFunction · 0.50

Calls 2

mt_hook_find_fdFunction · 0.85
ff_hook_setsockoptFunction · 0.70

Tested by

no test coverage detected