Skip to content

Conversation

@ConnorRigby
Copy link

This adds support for libwebsockets
the port is pretty simple, mostly the same as the freertos platform used by esp32

-DLWS_PLAT_NX=ON \
-DLWS_WITH_UDP=OFF \
-DLWS_WITH_FILE_OPS=OFF \
-DCMAKE_BUILD_TYPE=DEBUG \
Copy link
Member

Choose a reason for hiding this comment

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

We want -DCMAKE_BUILD_TYPE=RELEASE here I think.

+#include <arpa/inet.h>
+#include <fcntl.h>
+#include <switch/kernel/mutex.h>
+#include <switch/services/bsd.h>
Copy link
Member

Choose a reason for hiding this comment

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

don't use this bsd header. We translate between newlib fds & horizon fds internally. Use standard <sys/socket.h>

+#define compatible_close(x) close(x)
+#define lws_plat_socket_offset() 0
+#define wsi_from_fd(A,B) A->lws_lookup[B - lws_plat_socket_offset()]
+#define shutdown(sockfd, how) bsdShutdown(sockfd, how)
Copy link
Member

Choose a reason for hiding this comment

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

shutdown is found in <sys/socket.h> don't use the bsd functions directly.

@ConnorRigby
Copy link
Author

Thanks for the review @WinterMute!
I just moved so it might take me a few more days to get to this, but i'll certainly get too it this week.

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