VirtualBox

Ignore:
Timestamp:
Jul 13, 2009 8:54:34 AM (16 years ago)
Author:
vboxsync
Message:

crOpenGL: add protocol version check(4108), add max connected clients check

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c

    r21028 r21523  
    319319}
    320320
    321 void crVBoxServerAddClient(uint32_t u32ClientID)
    322 {
    323     CRClient *newClient = (CRClient *) crCalloc(sizeof(CRClient));
    324    
     321int32_t crVBoxServerAddClient(uint32_t u32ClientID)
     322{
     323    CRClient *newClient;
     324
     325    if (cr_server.numClients>=CR_MAX_CLIENTS)
     326    {
     327        return VERR_MAX_THRDS_REACHED;
     328    }
     329
     330    newClient = (CRClient *) crCalloc(sizeof(CRClient));   
    325331    crDebug("crServer: AddClient u32ClientID=%d", u32ClientID);
    326332
     
    336342
    337343    crServerAddToRunQueue(newClient);
     344
     345    return VINF_SUCCESS;
    338346}
    339347
     
    363371}
    364372
    365 void crVBoxServerClientWrite(uint32_t u32ClientID, uint8_t *pBuffer, uint32_t cbBuffer)
     373int32_t crVBoxServerClientWrite(uint32_t u32ClientID, uint8_t *pBuffer, uint32_t cbBuffer)
    366374{
    367375    CRClient *pClient;
     
    380388    pClient = cr_server.clients[i];
    381389    CRASSERT(pClient);
     390
     391    if (!pClient->conn->vMajor) return VERR_NOT_SUPPORTED;
    382392
    383393    CRASSERT(pBuffer);
     
    436446
    437447    CRASSERT(!pClient->conn->allow_redir_ptr || crNetNumMessages(pClient->conn)==0);
     448
     449    return VINF_SUCCESS;
    438450}
    439451
     
    456468    CRASSERT(pClient);
    457469
     470    if (!pClient->conn->vMajor) return VERR_NOT_SUPPORTED;
     471
    458472    if (pClient->conn->cbHostBuffer > *pcbBuffer)
    459473    {
     
    478492   
    479493    return VINF_SUCCESS;
     494}
     495
     496int32_t crVBoxServerClientSetVersion(uint32_t u32ClientID, uint32_t vMajor, uint32_t vMinor)
     497{
     498    CRClient *pClient;
     499    int32_t i;
     500
     501    for (i = 0; i < cr_server.numClients; i++)
     502    {
     503        if (cr_server.clients[i] && cr_server.clients[i]->conn
     504            && cr_server.clients[i]->conn->u32ClientID==u32ClientID)
     505        {
     506            break;
     507        }
     508    }
     509    pClient = cr_server.clients[i];
     510    CRASSERT(pClient);
     511
     512    pClient->conn->vMajor = vMajor;
     513    pClient->conn->vMinor = vMinor;
     514
     515    if (vMajor != CR_PROTOCOL_VERSION_MAJOR
     516        || vMinor != CR_PROTOCOL_VERSION_MINOR)
     517    {
     518        return VERR_NOT_SUPPORTED;
     519    }
     520    else return VINF_SUCCESS;
    480521}
    481522
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette