Re-structure to handle memory corruption better.

This is a workaround for now, will dig into it Monday. The socket ptr is being
messed up between the send and the disconnect. Unsure as to precicely where, or
why. Currently I have a feeling that an error value is not being checked
properly and is nullifying the socket for whatever reason.