Added locks to relay_server.