Show
Ignore:
Timestamp:
03/03/10 19:27:35 (2 years ago)
Author:
gbastien
Message:

* Modifs on the token architecture: some corrections to connection and token deletions and garbage collection because token are now reusable

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/newtoken/wifidog/classes/Token.php

    r1446 r1455  
    9696                 * Delete all unused tokens for this user, so we don't fill the database 
    9797                 * with them 
     98                 * But make sure the unused token is not associated with previous successful connections, so when the incoming field is null 
    9899                 */ 
    99                 $sql = "DELETE FROM connections USING tokens "."WHERE tokens.token_id=connections.token_id AND token_status='".TOKEN_UNUSED."' AND user_id = '".$user->getId()."';\n"; 
     100                $sql = "DELETE FROM connections USING tokens "."WHERE tokens.token_id=connections.token_id AND token_status='".TOKEN_UNUSED."' AND incoming is null AND user_id = '".$user->getId()."';\n"; 
    100101                $db->execSqlUpdate($sql, false); 
    101102 
     
    116117                    // look for an existing token that can be reused 
    117118                    // get all unexpired tokens ordered by first used time 
     119                    // TODO: The token may be owned by someone but be unused and have no connection associated with it 
    118120                    $sql =  "SELECT t.token_id, tt.token_max_total_data, tt.token_max_incoming_data, tt.token_max_outgoing_data,  
    119121                                                                LEAST((c.first_used_time + tt.token_max_usage_duration - c.total_connection_duration),