Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
b9d2f1e8
Commit
b9d2f1e8
authored
May 19, 2022
by
iabdalkader
Committed by
Damien George
May 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extmod/modusocket: Add timeout and callback to socket object.
parent
6841fecb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
extmod/modnetwork.h
extmod/modnetwork.h
+2
-1
extmod/modusocket.c
extmod/modusocket.c
+4
-3
No files found.
extmod/modnetwork.h
View file @
b9d2f1e8
...
...
@@ -86,9 +86,10 @@ typedef struct _mod_network_socket_obj_t {
uint32_t
proto
:
5
;
uint32_t
bound
:
1
;
int32_t
fileno
:
16
;
int32_t
timeout
;
mp_obj_t
callback
;
#if MICROPY_PY_USOCKET_EXTENDED_STATE
// Extended socket state for NICs/ports that need it.
int32_t
timeout
;
void
*
state
;
#endif
}
mod_network_socket_obj_t
;
...
...
extmod/modusocket.c
View file @
b9d2f1e8
...
...
@@ -71,9 +71,9 @@ STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t
}
}
}
#if MICROPY_PY_USOCKET_EXTENDED_STATE
s
->
timeout
=
-
1
;
s
->
callback
=
MP_OBJ_NULL
;
#if MICROPY_PY_USOCKET_EXTENDED_STATE
s
->
state
=
NULL
;
#endif
...
...
@@ -169,8 +169,9 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
socket2
->
proto
=
self
->
proto
;
socket2
->
bound
=
false
;
socket2
->
fileno
=
-
1
;
#if MICROPY_PY_USOCKET_EXTENDED_STATE
socket2
->
timeout
=
-
1
;
socket2
->
callback
=
MP_OBJ_NULL
;
#if MICROPY_PY_USOCKET_EXTENDED_STATE
socket2
->
state
=
NULL
;
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment