endpoints have socket-specific rather than global scope

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Deallocation of individual socket types fixed

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>