cbs/CbsServer/ServerSrc/CCbsScheduler.cpp
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  This module contains the implementation of CCbsScheduler class 
       
    15 *                member functions.   
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 //  INCLUDES
       
    21 #include "CbsServerPanic.h"
       
    22 #include "CCbsScheduler.h"
       
    23 #include "CCbsServer.h"
       
    24  
       
    25 // ================= MEMBER FUNCTIONS =======================
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CCbsScheduler::CCbsScheduler
       
    29 // C++ default constructor can NOT contain any code, that
       
    30 // might leave.
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 CCbsScheduler::CCbsScheduler()
       
    34     {
       
    35     }
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CCbsScheduler::SetServer
       
    39 // Gives a pointer of the current CCbsServer instance to the scheduler.
       
    40 // (other items were commented in a header).
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 void CCbsScheduler::SetServer( 
       
    44     CCbsServer* aServer )
       
    45     {
       
    46     iServer = aServer;
       
    47     }
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CCbsScheduler::Error
       
    51 // Overridden to handle leaves in request functions and unexpected situations.
       
    52 // (other items were commented in a header).
       
    53 // -----------------------------------------------------------------------------
       
    54 //
       
    55 void CCbsScheduler::Error( 
       
    56     TInt aError ) const
       
    57     {
       
    58     // Server caused the error
       
    59     if ( iServer->IsActive() )
       
    60         {
       
    61         __DEBUGGER();
       
    62         }
       
    63     else
       
    64         {
       
    65         // Panic the client.
       
    66         if ( aError == KErrBadDescriptor )
       
    67             {
       
    68             iServer->PanicClient( KErrBadDescriptor );
       
    69             }
       
    70         // Otherwise relay the error code to the client and restart the server
       
    71         iServer->ServerMessage().Complete( aError );
       
    72         iServer->ReStart();
       
    73         }    
       
    74     }
       
    75 
       
    76 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
    77 //  End of File