do fast metatable checking in socket.c; add socket.type