Have you tried printing the £current_user.contentobject_id and $anonymous_user_id to see if they match?
Anyways, EZ has a built-in function to check for login: http://ez.no/ez_publish/documentation/reference/data_fetching/user/is_logged_in . It might work using that.
{let thisuser=fetch('user','current_user')}
{section show=$thisuser.is_logged_in}
<p>Welcome. You are logged in as {$thisuser.contentobject.name}</p>
<p><a href={"/user/logout"|ezurl}>Logout</a></p>
{section-else}
<p><a href={"/user/login/"|ezurl}> Login</a></p>
{/section}
{/let}
</div>