If you select an address with the -connect command line parameter it isn,t "AddAddress"ed before connecting to it. For -addnode nodes there is a block of code that does it in init.cpp::AppInit2(int argc, char* argv[]) around line 470.
In net.cpp::ConnectNode(CAddress addrConnect, int64 nTimeout) then a funny thing happen:
CRITICAL_BLOCK(cs_mapAddresses)
mapAddresses[addrConnect.GetKey()].nLastTry = GetAdjustedTime();
Here an "empty" address is created in mapAddresses with only nLastTry correctly valued. You can check it by changing the code to something like
CRITICAL_BLOCK(cs_mapAddresses)
{
if (mapAddresses.count(addrConnect.GetKey()) == 0)
{
printf("*** Missing address in mapAddresses: ");
addrConnect.print();
mapAddresses[addrConnect.GetKey()].nLastTry = GetAdjustedTime();
printf("*** Now the address in mapAddresses is ");
mapAddresses[addrConnect.GetKey()].print();
}
else
{
mapAddresses[addrConnect.GetKey()].nLastTry = GetAdjustedTime();
}
}