Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
non-destructive text micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
badge fixer
non-destructive text micropython
Commits
9b2a97a9
Commit
9b2a97a9
authored
Feb 28, 2019
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
extmod/modwebrepl: Fix logic to handle a put of file of size 0.
Fixes issue #4499.
parent
ed1a88e2
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
extmod/modwebrepl.c
+11
-6
11 additions, 6 deletions
extmod/modwebrepl.c
with
11 additions
and
6 deletions
extmod/modwebrepl.c
+
11
−
6
View file @
9b2a97a9
...
@@ -108,6 +108,15 @@ STATIC mp_obj_t webrepl_make_new(const mp_obj_type_t *type, size_t n_args, size_
...
@@ -108,6 +108,15 @@ STATIC mp_obj_t webrepl_make_new(const mp_obj_type_t *type, size_t n_args, size_
return
o
;
return
o
;
}
}
STATIC
void
check_file_op_finished
(
mp_obj_webrepl_t
*
self
)
{
if
(
self
->
data_to_recv
==
0
)
{
mp_stream_close
(
self
->
cur_file
);
self
->
hdr_to_recv
=
sizeof
(
struct
webrepl_file
);
DEBUG_printf
(
"webrepl: Finished file operation %d
\n
"
,
self
->
hdr
.
type
);
write_webrepl_resp
(
self
->
sock
,
0
);
}
}
STATIC
int
write_file_chunk
(
mp_obj_webrepl_t
*
self
)
{
STATIC
int
write_file_chunk
(
mp_obj_webrepl_t
*
self
)
{
const
mp_stream_p_t
*
file_stream
=
mp_get_stream
(
self
->
cur_file
);
const
mp_stream_p_t
*
file_stream
=
mp_get_stream
(
self
->
cur_file
);
byte
readbuf
[
2
+
256
];
byte
readbuf
[
2
+
256
];
...
@@ -160,6 +169,7 @@ STATIC void handle_op(mp_obj_webrepl_t *self) {
...
@@ -160,6 +169,7 @@ STATIC void handle_op(mp_obj_webrepl_t *self) {
if
(
self
->
hdr
.
type
==
PUT_FILE
)
{
if
(
self
->
hdr
.
type
==
PUT_FILE
)
{
self
->
data_to_recv
=
self
->
hdr
.
size
;
self
->
data_to_recv
=
self
->
hdr
.
size
;
check_file_op_finished
(
self
);
}
else
if
(
self
->
hdr
.
type
==
GET_FILE
)
{
}
else
if
(
self
->
hdr
.
type
==
GET_FILE
)
{
self
->
data_to_recv
=
1
;
self
->
data_to_recv
=
1
;
}
}
...
@@ -266,12 +276,7 @@ STATIC mp_uint_t _webrepl_read(mp_obj_t self_in, void *buf, mp_uint_t size, int
...
@@ -266,12 +276,7 @@ STATIC mp_uint_t _webrepl_read(mp_obj_t self_in, void *buf, mp_uint_t size, int
}
}
}
}
if
(
self
->
data_to_recv
==
0
)
{
check_file_op_finished
(
self
);
mp_stream_close
(
self
->
cur_file
);
self
->
hdr_to_recv
=
sizeof
(
struct
webrepl_file
);
DEBUG_printf
(
"webrepl: Finished file operation %d
\n
"
,
self
->
hdr
.
type
);
write_webrepl_resp
(
self
->
sock
,
0
);
}
#ifdef MICROPY_PY_WEBREPL_DELAY
#ifdef MICROPY_PY_WEBREPL_DELAY
// Some platforms may have broken drivers and easily gets
// Some platforms may have broken drivers and easily gets
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment