Socket cleanup

Shouldn't this be inverted?