Fix app manager fail to install large app file issue (#555)
Remove the limit of app file size no larger than 1 MB, fix possible memory leak issues when fail to install app file, change message size of aee_host_msg_callback() from uint16 type to uint32 type to fix possible integer overflow issue, and fix some coding style issues of app manager. Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
@ -115,7 +115,6 @@ bool uart_init(const char *device, int baudrate, int *fd)
|
||||
}
|
||||
|
||||
*fd = uart_fd;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -133,11 +132,10 @@ bool udp_send(const char *address, int port, const char *buf, int len)
|
||||
servaddr.sin_port = htons(port);
|
||||
servaddr.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
sendto(sockfd, buf, len, MSG_CONFIRM, (const struct sockaddr *) &servaddr,
|
||||
sizeof(servaddr));
|
||||
sendto(sockfd, buf, len, MSG_CONFIRM,
|
||||
(const struct sockaddr *)&servaddr, sizeof(servaddr));
|
||||
|
||||
close(sockfd);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -150,7 +148,8 @@ bool host_tool_send_data(int fd, const char *buf, unsigned int len)
|
||||
return false;
|
||||
}
|
||||
|
||||
resend: ret = write(fd, buf, len);
|
||||
resend:
|
||||
ret = write(fd, buf, len);
|
||||
|
||||
if (ret == -1) {
|
||||
if (errno == ECONNRESET) {
|
||||
@ -192,17 +191,21 @@ int on_imrt_link_byte_arrive(unsigned char ch, imrt_link_recv_context_t *ctx)
|
||||
|
||||
if (leading[0] == ch) {
|
||||
ctx->phase = Phase_Leading;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
} else if (ctx->phase == Phase_Leading) {
|
||||
}
|
||||
else if (ctx->phase == Phase_Leading) {
|
||||
if (leading[1] == ch) {
|
||||
SET_RECV_PHASE(ctx, Phase_Type);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ctx->phase = Phase_Non_Start;
|
||||
return -1;
|
||||
}
|
||||
} else if (ctx->phase == Phase_Type) {
|
||||
}
|
||||
else if (ctx->phase == Phase_Type) {
|
||||
unsigned char *p = (unsigned char *) &ctx->message.message_type;
|
||||
p[ctx->size_in_phase++] = ch;
|
||||
|
||||
@ -210,7 +213,8 @@ int on_imrt_link_byte_arrive(unsigned char ch, imrt_link_recv_context_t *ctx)
|
||||
ctx->message.message_type = ntohs(ctx->message.message_type);
|
||||
SET_RECV_PHASE(ctx, Phase_Size);
|
||||
}
|
||||
} else if (ctx->phase == Phase_Size) {
|
||||
}
|
||||
else if (ctx->phase == Phase_Size) {
|
||||
unsigned char * p = (unsigned char *) &ctx->message.payload_size;
|
||||
p[ctx->size_in_phase++] = ch;
|
||||
|
||||
@ -237,7 +241,8 @@ int on_imrt_link_byte_arrive(unsigned char ch, imrt_link_recv_context_t *ctx)
|
||||
ctx->message.payload = (char *) malloc(ctx->message.payload_size);
|
||||
SET_RECV_PHASE(ctx, Phase_Payload);
|
||||
}
|
||||
} else if (ctx->phase == Phase_Payload) {
|
||||
}
|
||||
else if (ctx->phase == Phase_Payload) {
|
||||
ctx->message.payload[ctx->size_in_phase++] = ch;
|
||||
|
||||
if (ctx->size_in_phase == ctx->message.payload_size) {
|
||||
|
||||
Reference in New Issue
Block a user