Merge in the server/client functions. [...]

This is a fix for a weird bug.
In my local machine (Arch linux 3.12.x) it worked fine, but when tested
on some other machine (diogenis server) it did not.

By merging/inlining the functions, it got fixed (!!)