Alec,
Am 30.04.19 um 13:59 schrieb Alec Liu:
> What if we just have a reference here, and using malloc to alloc some memory
> for those connections which are going to use socks proxy only. It will be
> NULL for those connections which won't need it. When the socks proxy handshake
> finished, we can have this part of memory freed, before turn it over
> for data usage.
>
> I will try to look into it, if we can reuse the "proxy protocol
> offset", if we want to keep the ability to
> allow using PROXY Protocol and socks proxy at the same time.
>
I can't comment on whether using a pointer here makes sense or not, but
please note that HAProxy includes a memory pool implementation in
include/common/memory.h ("REGISTER_POOL"). I believe all your
allocations will have the same size which fits and you don't have to
annoy the system libc malloc all the time.
Best regards
Tim Düsterhus