Skip to content

Conversation

@kureuil
Copy link
Contributor

@kureuil kureuil commented May 20, 2018

BLOCKED: this PR needs a fix that only recently landed on cookie-factory's master branch (see rust-bakery/cookie-factory#9).

The AMQPCodec::encode function overwrote the contents of the buffer
given to it, forcing its users to flush the buffer after encoding each
item.

The new implementation simplifies AMQPTransport and especially allows
for the removal of the flush_needed attribute.

start: gen_class(class) >>
end: gen_at_offset!(len, gen_be_u32!(end - start)) >>
gen_be_u8!(constants::FRAME_END)
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, I was pretty sure I did something similar already... found it: https://github.com/sozu-proxy/amq-protocol/blob/master/protocol/src/frame/generation.rs#L19

I thought I synced that a while ago but apparently I didn't.
Will sync all that stuff soonish after some testing

@Keruspe
Copy link
Collaborator

Keruspe commented May 20, 2018

LGTM once we get a new cookie-factory release

@Keruspe
Copy link
Collaborator

Keruspe commented May 21, 2018

Btw, with this we can bring back and use the Sink impl right?

@kureuil
Copy link
Contributor Author

kureuil commented May 22, 2018

Yep, I'm planning on adding a few more tests, I'll also restore the Sink impl

kureuil added 2 commits May 22, 2018 15:58
The `AMQPCodec::encode` function overwrote the contents of the buffer
given to it, forcing its users to flush the buffer after encoding each
item.

The new implementation simplifies `AMQPTransport` and especially allows
for the removal of the `flush_needed` attribute.
@Keruspe
Copy link
Collaborator

Keruspe commented May 22, 2018

Rebased on current master, now that cookie-factory 0.2.4 has been released

@coveralls
Copy link

coveralls commented May 22, 2018

Coverage Status

Coverage increased (+1.7%) to 54.828% when pulling bba628c on kureuil:fix-amqpcodec into e5bb03d on sozu-proxy:master.

@kureuil
Copy link
Contributor Author

kureuil commented May 22, 2018

Thanks, I'll push the rest tonight or tomorrow

kureuil added 3 commits May 23, 2018 14:03
This will prevent putting too much strain on the allocator in the case
of a frame consisting of many parts exceeding the buffer's capacity.

Also, the threshold to a reallocation is now 1/4th of a frame, which is
1/8th of the space allocated.
Add a test with a frame more complex than the heartbeat one & a test
regarding the behaviour of buffer capacity expansion.
@Keruspe
Copy link
Collaborator

Keruspe commented May 23, 2018

Thanks !

@Keruspe Keruspe merged commit e5974dc into amqp-rs:master May 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants