SignatureBeef/Open-Terraria-API

Send section problem

AxeelAnder opened this issue · 6 comments

If a section is very complicated, it's size will overflow the buffer. Clients recieved the broken tiles data and throw an exception, it causes the section can't be shown correctly.
This bug only exists in modified server, vanilla server works well.
Expand the buffer can solve it as I tried.

This happens in a vanilla OTAPI server, or a TSAPI/OTAPI/Mintaka mix?
On Fri, Oct 19, 2018 at 22:49 Axeel @.***> wrote: If a section is very complicated, it's size will overflow the buffer. Clients recieved the broken tiles data and throw an exception, it causes the section can't be shown correctly. This bug only exists in modified server, vanilla server works well. Expand the buffer can solve it as I tried. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#14>, or mute the thread https://github.com/notifications/unsubscribe-auth/AAggp4Z40ZDaTFeVUtxPjsUI2dQd79ihks5umrlKgaJpZM4Xxvmd .
-- Lucas Nicodemus http://keybase.io/xn

happens in both

it's easy to write a patch to fix it, but idk the appropriate size

Also @AxeelAnder sign up for https://hacktoberfest.digitalocean.com first so you can get a shirt

Technical difficulties commenting on the PR, so this is what I was trying to say:

@AxeelAnder Basically if it's not a problem in vanilla and it can be replicated using stock OTAPI then it should be an OTAPI fix rather than TShock. However that fix is probably best suited for TShock, and if the guys are happy for that go nuts.

I had a quick look and I don't think that buffer is actually required with a bit more modification work, e.g. directly write the data from within NetMessage.CompressTileBlock by passing down the BinaryWriter from NetMessage.SendData; or similarly by redirecting the CompressTileBlock call in SendData to a OTAPI version so it can be done via C# instead of patching.
Though as fun as this sounds I don't have the time to do this so your fix should work fine via TShocks' config.