add sock_err helper function
remove unneeded struct member
correctly check log level
simplify poll related functions