Skip to content

[Bug]: NetworkMessage always increase size even when it's not needed #4877

Open
@ArturKnopik

Description

@ArturKnopik

By submitting this bug issue, you agree to the following.

  • This is a bug in the software that resides in this repository, and not a support matter (use https://otland.net/forums/support.16/ for support)
  • This issue is reproducible without changes to the C++ code in this repository
  • This bug has not been resolved in master branch
  • There is no existing issue for this bug already

Does this bug crash tfs?

no

Server Version

1.7 (Master)

Operation System

all (listed below)

OS Description

No response

Bug description

Adding data to network message always increase it size even if it's not required

Possible Pull Requests which are to blame

N/A

Steps to reproduce

put this code to lua script and execute

local msg = NetworkMessage()
msg:addByte(1)
msg:addByte(2)
msg:addByte(0)
msg:addByte(4)
print(msg:len()) -- will return 4
msg:seek(1) -- set write position
msg:addByte(2) -- already used field
print(msg:len()) -- will return 5

@edit updated returned len() values to valid ones

Actual Behavior

Message size increases when not required

Expected Behavior

Message size increases only when required

Backtrace

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn issue describing unexpected behavior of codegood first issueIssues that are easy to get started withpriority: lowIssues with this label won’t have the immediate focus

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions