]> git.lizzy.rs Git - minetest.git/blobdiff - src/clientiface.cpp
Don't expire blocks visible to the client. (#13255)
[minetest.git] / src / clientiface.cpp
index a4bfb824259724015a2c2f2c14ad49306409b6d4..8ae2efada1e14e3605390a720d38dbf35d333da0 100644 (file)
@@ -294,12 +294,6 @@ void RemoteClient::GetNextBlocks (
                                continue;
                        }
 
-                       /*
-                               Don't send already sent blocks
-                       */
-                       if (m_blocks_sent.find(p) != m_blocks_sent.end())
-                               continue;
-
                        /*
                                Check if map has this block
                        */
@@ -310,8 +304,14 @@ void RemoteClient::GetNextBlocks (
                                // Reset usage timer, this block will be of use in the future.
                                block->resetUsageTimer();
 
+                               /*
+                                       Don't send already sent blocks
+                               */
+                               if (m_blocks_sent.find(p) != m_blocks_sent.end())
+                                       continue;
+
                                // Check whether the block exists (with data)
-                               if (block->isDummy() || !block->isGenerated())
+                               if (!block->isGenerated())
                                        block_not_found = true;
 
                                /*
@@ -472,20 +472,14 @@ void RemoteClient::notifyEvent(ClientStateEvent event)
                {
                case CSE_AuthAccept:
                        m_state = CS_AwaitingInit2;
-                       if (chosen_mech == AUTH_MECHANISM_SRP ||
-                                       chosen_mech == AUTH_MECHANISM_LEGACY_PASSWORD)
-                               srp_verifier_delete((SRPVerifier *) auth_data);
-                       chosen_mech = AUTH_MECHANISM_NONE;
+                       resetChosenMech();
                        break;
                case CSE_Disconnect:
                        m_state = CS_Disconnecting;
                        break;
                case CSE_SetDenied:
                        m_state = CS_Denied;
-                       if (chosen_mech == AUTH_MECHANISM_SRP ||
-                                       chosen_mech == AUTH_MECHANISM_LEGACY_PASSWORD)
-                               srp_verifier_delete((SRPVerifier *) auth_data);
-                       chosen_mech = AUTH_MECHANISM_NONE;
+                       resetChosenMech();
                        break;
                default:
                        myerror << "HelloSent: Invalid client state transition! " << event;
@@ -561,9 +555,7 @@ void RemoteClient::notifyEvent(ClientStateEvent event)
                        break;
                case CSE_SudoSuccess:
                        m_state = CS_SudoMode;
-                       if (chosen_mech == AUTH_MECHANISM_SRP)
-                               srp_verifier_delete((SRPVerifier *) auth_data);
-                       chosen_mech = AUTH_MECHANISM_NONE;
+                       resetChosenMech();
                        break;
                /* Init GotInit2 SetDefinitionsSent SetMediaSent SetDenied */
                default:
@@ -598,7 +590,7 @@ void RemoteClient::notifyEvent(ClientStateEvent event)
 
 void RemoteClient::resetChosenMech()
 {
-       if (chosen_mech == AUTH_MECHANISM_SRP) {
+       if (auth_data) {
                srp_verifier_delete((SRPVerifier *) auth_data);
                auth_data = nullptr;
        }