-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Enable* web workflow for Pico W #7247
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,7 +240,7 @@ socketpool_socket_obj_t *common_hal_socketpool_socket(socketpool_socketpool_obj_ | |
return sock; | ||
} | ||
|
||
int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port) { | ||
int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port, socketpool_socket_obj_t *accepted) { | ||
struct sockaddr_in accept_addr; | ||
socklen_t socklen = sizeof(accept_addr); | ||
int newsoc = -1; | ||
|
@@ -274,12 +274,25 @@ int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_ | |
lwip_close(newsoc); | ||
return -MP_EBADF; | ||
} | ||
|
||
|
||
if (accepted != NULL) { | ||
// Close the active socket because we have another we accepted. | ||
if (!common_hal_socketpool_socket_get_closed(accepted)) { | ||
common_hal_socketpool_socket_close(accepted); | ||
} | ||
// Create the socket | ||
accepted->num = newsoc; | ||
accepted->pool = self->pool; | ||
accepted->connected = true; | ||
} | ||
|
||
return newsoc; | ||
} | ||
|
||
socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_obj_t *self, | ||
uint8_t *ip, uint32_t *port) { | ||
int newsoc = socketpool_socket_accept(self, ip, port); | ||
int newsoc = socketpool_socket_accept(self, ip, port, NULL); | ||
|
||
if (newsoc > 0) { | ||
mark_user_socket(newsoc); | ||
|
@@ -554,6 +567,15 @@ void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t *self, uint | |
self->timeout_ms = timeout_ms; | ||
} | ||
|
||
|
||
int common_hal_socketpool_socket_setsockopt(socketpool_socket_obj_t *self, int level, int optname, const void *value, size_t optlen) { | ||
int err = lwip_setsockopt(self->num, level, optname, value, optlen); | ||
if (err != 0) { | ||
return -errno; | ||
} | ||
return 0; | ||
} | ||
|
||
bool common_hal_socketpool_readable(socketpool_socket_obj_t *self) { | ||
struct timeval immediate = {0, 0}; | ||
|
||
|
@@ -577,3 +599,18 @@ bool common_hal_socketpool_writable(socketpool_socket_obj_t *self) { | |
// including returning true in the error case | ||
return num_triggered != 0; | ||
} | ||
|
||
void socketpool_socket_move(socketpool_socket_obj_t *self, socketpool_socket_obj_t *sock) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is the invariant here that the "sock" socket is guaranteed not open, so that it doesn't need to be closed or otherwise operated on? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that should be true. I'll add a check just in case. (Maybe you could get a second websocket request at the same time the first is open.) |
||
*sock = *self; | ||
self->connected = false; | ||
self->num = -1; | ||
} | ||
|
||
void socketpool_socket_reset(socketpool_socket_obj_t *self) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this need to close the underlying socket, or is the invariant that the underlying socket is already always closed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should have never been used. This is really to set the memory so it reads as closed before it is used. Happy to rename if you have a better name suggestion. |
||
if (self->base.type == &socketpool_socket_type) { | ||
return; | ||
} | ||
self->base.type = &socketpool_socket_type; | ||
self->connected = false; | ||
self->num = -1; | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you just say a few words about what's going on with this removal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it from each port because the implementation was the same or worse. Now there is a shared implementation in
supervisor/
. I did this here because workflows use anoverride_fattime
call to set the file modification time based on the API transaction's time rather than the internal RTC.