Added optional debuging logs. Will remove later.
Check for null socket before allocating headers.
I think this reallocation is completely unnecessary and is being triggered by memory corruption from the bad libev python adapater for pika.
It doesn't occur without.