Make static, no need for outside visibility.
Shuffle the routines to match the life cycle of the connections.
Rename fd argument as server_fd.
Reset the fields immediately after their releases.
In fact the server socket is not needed in close.
Whitespace only.