summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/message-port.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/message-port.c b/src/message-port.c
index 17c4943..523027a 100755
--- a/src/message-port.c
+++ b/src/message-port.c
@@ -1366,6 +1366,19 @@ int __message_port_send_async(int sockfd, bundle *kb, const char *local_port,
unsigned int nb;
bundle_raw *kb_data = NULL;
+ bundle_encode(kb, &kb_data, &data_len);
+ if (kb_data == NULL) {
+ _LOGE("bundle encode fail");
+ ret = MESSAGEPORT_ERROR_IO_ERROR;
+ goto out;
+ }
+
+ if (data_len > MAX_MESSAGE_SIZE) {
+ _LOGE("bigger than max size\n");
+ ret = MESSAGEPORT_ERROR_MAX_EXCEEDED;
+ goto out;
+ }
+
if (local_port != NULL)
local_port_len = strlen(local_port) + 1;
@@ -1384,19 +1397,6 @@ int __message_port_send_async(int sockfd, bundle *kb, const char *local_port,
return MESSAGEPORT_ERROR_IO_ERROR;
}
- bundle_encode(kb, &kb_data, &data_len);
- if (kb_data == NULL) {
- _LOGE("bundle encode fail");
- ret = MESSAGEPORT_ERROR_IO_ERROR;
- goto out;
- }
-
- if (data_len > MAX_MESSAGE_SIZE) {
- _LOGE("bigger than max size\n");
- ret = MESSAGEPORT_ERROR_MAX_EXCEEDED;
- goto out;
- }
-
if (__write_string_to_socket(sockfd, (void *)kb_data, data_len) != MESSAGEPORT_ERROR_NONE) {
_LOGE("write kb_data fail");
ret = MESSAGEPORT_ERROR_IO_ERROR;