Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ranch 2.1 compatibility #1

Merged
merged 2 commits into from
Jan 16, 2023

Conversation

chrzaszcz
Copy link
Member

@chrzaszcz chrzaszcz commented Jan 16, 2023

Support ranch 2.1, which is required by mongoose c2s.

The target branch is now called mongooseim-ranch-compatibility, and is an exact copy of https://github.com/michalwski/nkpacket/tree/ranch-1.7-compatibility, which was used by MongooseIM. That branch contained a quick fix, which enabled using the nksip listener with MongooseIM. However, the support for ranch 1.7 was only partial, and functionality not required by MongooseIM was not working.

I decided to continue on that route to avoid any significant rewrite of the library, because MongooseIM is only using a small part of it. As a result, the change only enables listening for and accepting TCP connections with ranch 2.1. The jingle_SUITE passes in MongooseIM. Unfortunately we don't have any further tests, but I think that the functionality is a lower-priority one, and this should be enough for now.

The 'socket' option is not supported anymore, and this means that:
- either new protocol modules would need to be implemented for TCP and TLS
- or ranch_tcp and ranch_tls could be used respectively.

This commit uses the second option for simplicity.
It required moving some initialization logic to 'ranch_init', because
the socket is not available before.
Use the latest cowboy and ranch, just like MongooseIM.
The cowboy-specific functionality might not work correctly,
but it is unused by MongooseIM.
@chrzaszcz chrzaszcz marked this pull request as ready for review January 16, 2023 10:31
Copy link

@NelsonVides NelsonVides left a comment

Choose a reason for hiding this comment

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

Looks good, pretty similar to what I had to do to fix global distribution 👌🏽

@NelsonVides NelsonVides merged commit 29cbf9c into mongooseim-ranch-compatibility Jan 16, 2023
@NelsonVides NelsonVides deleted the ranch-2.1-compatibility branch January 16, 2023 11:46
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