Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
a243d6b0
Commit
a243d6b0
authored
Jul 16, 2015
by
Daniel Campora
Browse files
cc3200: Make socket stream methods return POSIX error codes.
parent
f7384244
Changes
2
Hide whitespace changes
Inline
Side-by-side
cc3200/mods/modusocket.c
View file @
a243d6b0
...
...
@@ -418,12 +418,24 @@ MP_DEFINE_CONST_DICT(socket_locals_dict, socket_locals_dict_table);
STATIC
mp_uint_t
socket_read
(
mp_obj_t
self_in
,
void
*
buf
,
mp_uint_t
size
,
int
*
errcode
)
{
mod_network_socket_obj_t
*
self
=
self_in
;
return
wlan_socket_recv
(
self
,
buf
,
size
,
errcode
);
mp_int_t
ret
=
wlan_socket_recv
(
self
,
buf
,
size
,
errcode
);
if
(
ret
<
0
)
{
ret
=
MP_STREAM_ERROR
;
// needed to convert simplelink's negative error codes to POSIX
(
*
errcode
)
*=
-
1
;
}
return
ret
;
}
STATIC
mp_uint_t
socket_write
(
mp_obj_t
self_in
,
const
void
*
buf
,
mp_uint_t
size
,
int
*
errcode
)
{
mod_network_socket_obj_t
*
self
=
self_in
;
return
wlan_socket_send
(
self
,
buf
,
size
,
errcode
);
mp_int_t
ret
=
wlan_socket_send
(
self
,
buf
,
size
,
errcode
);
if
(
ret
<
0
)
{
ret
=
MP_STREAM_ERROR
;
// needed to convert simplelink's negative error codes to POSIX
(
*
errcode
)
*=
-
1
;
}
return
ret
;
}
STATIC
mp_uint_t
socket_ioctl
(
mp_obj_t
self_in
,
mp_uint_t
request
,
mp_uint_t
arg
,
int
*
errcode
)
{
...
...
cc3200/mods/modwlan.c
View file @
a243d6b0
...
...
@@ -1357,7 +1357,7 @@ int wlan_socket_ioctl (mod_network_socket_obj_t *s, mp_uint_t request, mp_uint_t
}
}
else
{
*
_errno
=
EINVAL
;
ret
=
-
1
;
ret
=
MP_STREAM_ERROR
;
}
return
ret
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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