Merge pull request #80 from xiangxistu/master

[update] abort receive when "session->handle_function" was failed.
master
xiangxistu 4 years ago committed by GitHub
commit 5fa2d6e924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -114,7 +114,11 @@ int webclient_shard_download_test(int argc, char **argv)
webclient_register_shard_position_function(session, shard_download_handle);
/* the "memory size" that you can provide in the project and uri */
webclient_shard_position_function(session, uri, 0, length, size);
result = webclient_shard_position_function(session, uri, 0, length, size);
if(result != WEBCLIENT_OK)
{
rt_kprintf("web shard download, test failed!\n");
}
/* clear the handle function */
webclient_register_shard_position_function(session, RT_NULL);

@ -1052,6 +1052,7 @@ int webclient_shard_head_function(struct webclient_session *session, const char
int webclient_shard_position_function(struct webclient_session *session, const char *URI, int start, int length, int mem_size)
{
int rc = WEBCLIENT_OK;
int result = RT_EOK;
int resp_status = 0;
int resp_len = 0;
char *buffer = RT_NULL;
@ -1151,7 +1152,11 @@ int webclient_shard_position_function(struct webclient_session *session, const c
if(data_len > 0)
{
start_position += mem_size;
session->handle_function(buffer, data_len);
result = session->handle_function(buffer, data_len);
if(result != RT_EOK)
{
return -WEBCLIENT_ERROR;
}
}
else
{

Loading…
Cancel
Save