Skip to content

Commit

Permalink
Fixed tagged message bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakio815 committed Feb 8, 2024
1 parent 7e9f360 commit c2f6f0a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/federated/network/lf_socket_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ netdrv_t *netdrv_init() {
priv->server_port = -1;
priv->server_ip_addr.s_addr = 0;

drv->read_remaining_bytes = 0;

// drv->open = socket_open;
drv->close = socket_close;
// drv->read = socket_read;
Expand Down Expand Up @@ -714,7 +716,7 @@ int read_from_netdrv(netdrv_t* netdrv, unsigned char* buffer, size_t buffer_leng
// return NULL;
case MSG_TYPE_TAGGED_MESSAGE: ;
bytes_to_read = sizeof(uint16_t) + sizeof(uint16_t) + sizeof(int32_t) + sizeof(int64_t) + sizeof(uint32_t);
state = READ_MSG_TYPE_TAGGED_MESSAGE; ;
state = READ_MSG_TYPE_TAGGED_MESSAGE;
break;
case MSG_TYPE_NEXT_EVENT_TAG:
bytes_to_read = sizeof(int64_t) + sizeof(uint32_t);
Expand Down Expand Up @@ -811,7 +813,7 @@ int read_from_netdrv(netdrv_t* netdrv, unsigned char* buffer, size_t buffer_leng
state = FINISH_READ;
break;
case READ_MSG_TYPE_TAGGED_MESSAGE: ;
size_t length = (size_t) extract_int32(buffer + sizeof(uint16_t) + sizeof(uint16_t));
size_t length = (size_t) extract_int32(buffer + 1+ sizeof(uint16_t) + sizeof(uint16_t));
if(length > buffer_length - total_bytes_read) {
bytes_to_read = buffer_length - total_bytes_read;
netdrv->read_remaining_bytes = length - bytes_to_read;
Expand Down

0 comments on commit c2f6f0a

Please sign in to comment.