lemunozm / message-io

Fast and easy-to-use event-driven network library.
Apache License 2.0
1.11k stars 74 forks source link

Fixed ResourceId for 32bits arch #42

Closed lemunozm closed 3 years ago

lemunozm commented 3 years ago

From: https://github.com/lemunozm/message-io/issues/41

It was not as simple as modifying the usize to u64 because mio uses an usize internally too and the value is clamped by the 32-bits OS poll.

The fix encodes the adapter id and resource type information into the less significant bits instead of the most significant bits to be sure that whatever word size is used in the OS, these values are always encoded into the ResourceId.