summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorpengxuanzheng <[email protected]>2021-10-13 18:46:17 +0800
committerpengxuanzheng <[email protected]>2021-10-13 18:46:17 +0800
commit0210e679f4dca5dd7942c1271f3f0115eb713395 (patch)
tree8e9559b44aceb1ddc97c1add4023a95f35a7d182 /example
parent20bc7e176c7e2ae247183d087c2c476e29a570a6 (diff)
🦄 refactor(TSG-7599): fd 保存thread_id
Diffstat (limited to 'example')
-rw-r--r--example/demo/hos_write_demo.cpp10
-rw-r--r--example/performance/HosClientPerformance.cpp8
2 files changed, 11 insertions, 7 deletions
diff --git a/example/demo/hos_write_demo.cpp b/example/demo/hos_write_demo.cpp
index 7f794e20..7d757a7c 100644
--- a/example/demo/hos_write_demo.cpp
+++ b/example/demo/hos_write_demo.cpp
@@ -54,6 +54,10 @@ int file_to_buffer(const char *file, char *buffer, int size)
void callback(bool result, const char *bucket, const char *object, const char *errormsg, size_t errorcode, void *userdata)
{
+ if (!result)
+ {
+ printf("error:[%d], %s\n", errorcode, errormsg);
+ }
return ;
}
@@ -128,15 +132,15 @@ int main(int argc, char *argv[])
printf("hos_write buff start ...\n");
snprintf(object, 1023, "%s_write_APPEND", file_name);
fd = hos_open_fd(bucket, object, callback, NULL, 0);
- if (hos_write(fd, buf, buffer.st_size, 0) != HOS_CLIENT_OK)
+ if (hos_write(fd, buf, buffer.st_size) != HOS_CLIENT_OK)
{
printf("error: hos_write failed 1st!\n");
}
- if (hos_write(fd, buf, buffer.st_size, 0) != HOS_CLIENT_OK)
+ if (hos_write(fd, buf, buffer.st_size) != HOS_CLIENT_OK)
{
printf("error: hos_write failed 2nd!\n");
}
- hos_close_fd(fd, 0);
+ hos_close_fd(fd);
printf("hos_write buff end ...\n");
printf("hos_shutdown_instance start ...\n");
diff --git a/example/performance/HosClientPerformance.cpp b/example/performance/HosClientPerformance.cpp
index cee829f7..59366474 100644
--- a/example/performance/HosClientPerformance.cpp
+++ b/example/performance/HosClientPerformance.cpp
@@ -155,7 +155,7 @@ static int upload_file(char *file, char *buff, int buff_len, thread_info_t *thre
{
clock_gettime(CLOCK_MONOTONIC, &tstart);
fd[i] = hos_open_fd(thread_info->bucket, thread_info->object, callback, NULL, thread_info->thread_num);
- if (hos_write(fd[i], file, 0, thread_info->thread_num) != HOS_CLIENT_OK)
+ if (hos_write(fd[i], file, 0) != HOS_CLIENT_OK)
{
printf("error:hos_write file:%s\n", file);
return -1;
@@ -225,10 +225,10 @@ static int upload_buff(char * buff, int buff_len, thread_info_t *thread_info, ch
rest = buff_len - tmp;
if (rest <= g_append_size)
{
- hos_write(fd[0], &buff[tmp], rest, thread_info->thread_num);
+ hos_write(fd[0], &buff[tmp], rest);
break;
}
- hos_write(fd[0], &buff[tmp], g_append_size, thread_info->thread_num);
+ hos_write(fd[0], &buff[tmp], g_append_size);
j++;
}
clock_gettime(CLOCK_MONOTONIC, &ttmp);
@@ -312,7 +312,7 @@ static int upload_buff(char * buff, int buff_len, thread_info_t *thread_info, ch
{
if (fd[i] > 2)
{
- hos_close_fd(fd[i], thread_info->thread_num);
+ hos_close_fd(fd[i]);
}
}