fix some protocol.cpp stuff, including getting the current threadid in a safer fashion and polling for socket data more correctly
fix some protocol.cpp stuff, including getting the current threadid in a safer fashion and polling for socket data more correctly

revmischa/grids,revmischa/grids