jjchiw / gelf4net

GELF log4net Appender - graylog2
MIT License
63 stars 59 forks source link

fixed issues with the chunks calculation, the loop in charge to send … #65

Closed MarcArumi closed 5 years ago

MarcArumi commented 5 years ago

…this chunks and the usage of the interlocked.read

As you may see with this patch I’m trying to fix 3 issues.

  1. With the current implementation the sender may send duplicated messages ids. Actually is reading the value and increment it in a thread safe way, but the read is not thread safe.

  2. ‘var chunkCount = (payload.Length / MaxChunkSize) + 1;’ Ex: chunksize 1024 and payload 2048, then chunkCount would be three when it should be two.

  3. ‘while (state.SendIndex <= state.ChunkCount)’ SendIndex start with 0 so it’s sending always and extra message

jjchiw commented 5 years ago

Hi @MarcArumi

I'm planning to merge the PR this weekend, but I don't understand the need to change the package name.... :/

So I'm going to merge your first commit in the PR https://github.com/jjchiw/gelf4net/pull/65/commits/1aef88c2df3d0457dd00e0d25dbe53f8c5cc203e

Thanks for the PR :)

MarcArumi commented 5 years ago

Hi @jjchiw my fault. Please use only the PR commit 1aef88c. I changed temporally the package name for my own projects but I pushed wrongly :S.

Thanks for the warning!