Conversation
…event # Conflicts: # .idea/workspace.xml # cmake-build-debug/.ninja_deps # cmake-build-debug/.ninja_log # cmake-build-debug/Testing/Temporary/LastTest.log
…statements at the end of void functions.
…statements at the end of void functions.
…statements at the end of void functions.
Master libevent
# Conflicts: # .github/workflows/build.yaml # src/datum_gateway.c
| #define IO_MAX_EVENTS 32 | ||
|
|
||
| static inline int datum_io_create() { | ||
| return kqueue(); |
There was a problem hiding this comment.
Missing a return value check for kqueue()
| } | ||
|
|
||
| static inline int portable_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *timeout) { | ||
| while (nanosleep(timeout, NULL) == -1 && errno == EINTR) continue; |
There was a problem hiding this comment.
I don't think this use of portable_mutex_timedlock() will work for Apple/BSD since this is using a sleep loop instead of proper timeout handling.
| #ifdef __linux__ | ||
| int wait_ms = 5; | ||
| #elif defined(__APPLE__) || defined(__BSD__) | ||
| int wait_ms = 5000; |
There was a problem hiding this comment.
Why is there a massive difference between Linux and Apple/BSD behavior for wait_ms?
| #ifdef __linux__ | ||
| if (events[0].events & (EPOLLERR | EPOLLHUP)) { | ||
| #elif defined(__APPLE__) || defined(__BSD__) | ||
| if (events[0].flags & EVFILT_EXCEPT) { |
| #ifdef __linux__ | ||
| if (events[0].events & EPOLLIN) { | ||
| #elif defined(__APPLE__) || defined(__BSD__) | ||
| if (events[0].flags & EV_ADD) { |
There was a problem hiding this comment.
Shouldn't this be using EVFILT_READ?
| my->ev.data.u64 = i; // store client index... duh | ||
| if (epoll_ctl(my->epollfd, EPOLL_CTL_ADD, my->client_data[i].fd, &my->ev) < 0) { | ||
| #elif defined(__APPLE__) || defined(__BSD__) | ||
| my->ev.flags = EV_ADD | EV_ONESHOT | EV_ERROR; |
There was a problem hiding this comment.
Instead of setting flags, shouldn't this be setting filter and events?
| static inline int datum_io_delete(IO_HANDLE kq, uintptr_t fd, struct kevent *evSet) | ||
| { | ||
| if (evSet) { | ||
| evSet->ident = fd; |
There was a problem hiding this comment.
For datum_io_delete and datum_io_modify, what happens if the parameter is NULL? Seems like this just sets it without checking...
|
|
||
| include(GNUInstallDirs) | ||
|
|
||
| if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") |
There was a problem hiding this comment.
Doesn't CMake already provide platform detection without you having to define them here explicitly?
| int val; | ||
| if (var_name_len_2 == 3 && 0 == strncmp(var_start_2, "*ro", 3)) { | ||
| if (var_name_len_2 == 16 && 0 == strncmp(var_start_2, "time_out_in_secs", 16)) | ||
| { |
There was a problem hiding this comment.
Missing else-if chaining could cause unnecessary string comparisons.
| // the ePIC control boards can handle almost any size coinbase | ||
| // UA starts with: PowerPlay-BM/ | ||
| if (strstr(m->useragent, "PowerPlay-BM/") == m->useragent) { | ||
| else if (strstr(m->useragent, "PowerPlay-BM/") == m->useragent) { |
There was a problem hiding this comment.
Changed if/return pattern to if/else-if without return, could be changing logic here?
|
Probably should split this up into multiple PRs |
macOS Support & Page Refresh