Skip to content

Support Discord async and fix its ratelimiting, improve flexibility of Orca's core functionalities, and more - #753

Merged
lcsmuller merged 255 commits into
masterfrom
multiplex
Dec 18, 2021
Merged

lcsmuller merged 255 commits into
masterfrom
multiplex

Conversation

@lcsmuller

@lcsmuller lcsmuller commented Dec 18, 2021 •

Copy link
Copy Markdown
Contributor

This PR accomplishes a bunch, most of which are internal refactoring which won't be listed here. Here are the main feature changes:

Discord

Client

  • Remove const struct discord_user *bot from callback parameters, which only forced an additional parameter that wasn't used very often. Added discord_get_self() as a replacement.

Adapter

  • Allow requests to be performed asynchronously via the curl_multi interface. All the code pertaining to the async logic can be found here. See test-discord-async.c for a usage example.

Ratelimiting

Orca

General

  • Add work.c to introduce a global threadpool that can be shared between different APIs
  • Add orca_global_init() and orca_global_cleanup() to common.c, as those include resources common to all APIs
  • Push other APIs (Github, Reddit, Slack) to be consistent with the Discord API

WebSockets

User-Agent

  • Improve flexibility by allowing the user to directly interface with each individual connection, instead of being forced to rely on a generic request function.

* refactor(user-agent): fix premature locking
* docs(user-agent): document leftover fields and a couple
  functionalities
* refactor(user-agent): make ua_conn a public opaque datatype, add a
  field for holding onto user callback and context
* feat(websockets.c): replace pthread_mutex with pthread_rwlock where it makes sense
* refactor(websockets.c): simplify ws_perform() to return a bool on whether the connection is alive
* refactor(websockets): add struct ws_attr for passing optional fields.
* feat(websockets): add ws_timestamp_update() for manually updating internally used timestamp
* refactor(websockets.c): remove noop functions and simply check for NULL
lcsmuller and others added 27 commits December 15, 2021 16:46
…tributes, to improve flexibility when adding new config
@lcsmuller lcsmuller changed the title Multiplex Support Discord async and fix its ratelimiting, improve flexibility of Orca's core functionalities, and more Dec 18, 2021
@lcsmuller
lcsmuller merged commit 96e3674 into master Dec 18, 2021
@lcsmuller
lcsmuller deleted the multiplex branch December 18, 2021 15:11
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.

2 participants