Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@snowyote
Copy link

pickin up the work from andy. this is a little weirdly shaped so suggestions welcome.

The intent is, if you compile with -DDISCORD_ENABLE_SENDMMSG then the sendmmsg() code will be compiled (so we omit that define on non-linux). However, the use_sendmmsg field on uv_udp_t is present on any *nix, and the UV_UDP_DISCORD_USE_SENDMMSG flag is present on every platform.

To actually use sendmmsg on a given uv_udp_t you call uv_udp_init_ex with the UV_UDP_DISCORD_USE_SENDMMSG flag.

If the flag is weird I could keep the field and just add a post-init function that turns on use_sendmmsg (or we could just write to it ourselves). Lmk whatchu thinks

Andy Dill and others added 3 commits November 18, 2015 10:38
- define DISCORD_ENABLE_SENDMMSG to build with sendmmsg (i.e. add this
when building on linux)

- pass in UV_UDP_DISCORD_USE_SENDMMSG in uv_udp_init_ex if you want
sendmmsg used on a particular udp handle
@snowyote snowyote requested review from adill and crmarsh March 29, 2017 18:06
Copy link
Member

@adill adill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌 lgtm. might be useful to expose the batch size, but there's no real need.

@snowyote snowyote merged commit 8a1ac3d into libdiscord Apr 11, 2017
snowyote pushed a commit that referenced this pull request May 7, 2019
Valgrind will emit the following error on a system where `int` is 32
bits:

==21616== Syscall param epoll_ctl(event) points to uninitialised byte(s)
==21616==    at 0x693E06A: epoll_ctl (syscall-template.S:84)
==21616==    by 0x529F35B: uv__io_poll (in .../libuv/libuv.so)
==21616==    by 0x528AE62: uv_run (in .../libuv/libuv.so)
[...]
==21616==  Address 0x1ffeffc8ec is on thread 1's stack
==21616==  in frame #1, created by uv__io_poll (???:)

We only initialise e.events and e.data.fd, meaning half of
e.data (the 32 bits not covered by the 4-byte `fd`) is
uninitialised.

PR-URL: libuv#1996
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
snowyote pushed a commit that referenced this pull request May 24, 2022
ERROR: LeakSanitizer: detected memory leaks

```
Direct leak of 432 byte(s) in 9 object(s) allocated from:
    #0 0x1062eedc2 in __sanitizer_mz_calloc+0x92 (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x46dc2)
    #1 0x7fff20171eb6 in _malloc_zone_calloc+0x3a (libsystem_malloc.dylib:x86_64+0x1beb6)
    #2 0x7fff203ac180 in _CFRuntimeCreateInstance+0x124 (CoreFoundation:x86_64h+0x4180)
    #3 0x7fff203ab906 in __CFStringCreateImmutableFunnel3+0x84d (CoreFoundation:x86_64h+0x3906)
    #4 0x7fff203ab0a1 in CFStringCreateWithCString+0x48 (CoreFoundation:x86_64h+0x30a1)
    #5 0x1056f63e1 in uv__get_cpu_speed darwin.c:267
    #6 0x1056f491e in uv_cpu_info darwin.c:338
```

PR-URL: libuv#3098
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants