Refactor frame encoding to its own function.
Refactor frame encoding to its own function.

Refactor frame encoding into its own function. This is in preparation for doing
heartbeats while waiting for the socket to become writable.

As a de-optimization: stop using writev for the body frames. This now requires
memcpy'ing the whole message body, which is an additional copy. On the flip side
this is already done behind the scenes on Linux and anything using OpenSSL. This
may also improve performance as fewer OS calls are made when writev doesn't
support SO_NOSIGNAL.

Haster2004/rabbitmq-c,hjzljp/rabbitmq-c,tempbottle/rabbitmq-c,sakishum/rabbitmq-c,chenwenbin928/rabbitmq-c,tempbottle/rabbitmq-c,alanxz/rabbitmq-c,alanxz/rabbitmq-c,chenwenbin928/rabbitmq-c,jqk6/rabbitmq-c,hjzljp/rabbitmq-c,jqk6/rabbitmq-c,jqk6/rabbitmq-c,kilinrax/rabbitmq-c,jqk6/rabbitmq-c,alanxz/rabbitmq-c,sakishum/rabbitmq-c,tempbottle/rabbitmq-c,Haster2004/rabbitmq-c,hjzljp/rabbitmq-c,kilinrax/rabbitmq-c,sakishum/rabbitmq-c,soindy/rabbitmq-c,soindy/rabbitmq-c,chenwenbin928/rabbitmq-c,tempbottle/rabbitmq-c,kilinrax/rabbitmq-c,Haster2004/rabbitmq-c,hjzljp/rabbitmq-c,soindy/rabbitmq-c