handling socket errors in proxy
session ended and some comments on logging