server_stream.c revision 3a3f10d6081fdacfd53f8c1fafc0efd2be153b7a
8bb7126c063c34d63966733988411f72dfcb2294maczniak/* Copyright (c) 2001, Stanford University
8bb7126c063c34d63966733988411f72dfcb2294maczniak * All rights reserved
8bb7126c063c34d63966733988411f72dfcb2294maczniak * See the file LICENSE.txt for information on redistributing this software.
8bb7126c063c34d63966733988411f72dfcb2294maczniak * Accept a new client connection, create a new CRClient and add to run queue.
8bb7126c063c34d63966733988411f72dfcb2294maczniak CRClient *newClient = (CRClient *) crCalloc(sizeof(CRClient));
8bb7126c063c34d63966733988411f72dfcb2294maczniak newClient->conn = crNetAcceptClient( cr_server.protocol, NULL,
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem /* add to array */
8bb7126c063c34d63966733988411f72dfcb2294maczniak cr_server.clients[cr_server.numClients++] = newClient;
8bb7126c063c34d63966733988411f72dfcb2294maczniak * Check if client is in the run queue.
8bb7126c063c34d63966733988411f72dfcb2294maczniak while (q) {
8bb7126c063c34d63966733988411f72dfcb2294maczniak return 0; /* back head */
8bb7126c063c34d63966733988411f72dfcb2294maczniak while (q) {
8bb7126c063c34d63966733988411f72dfcb2294maczniak RunQueue *q = (RunQueue *) crAlloc( sizeof( *q ) );
8bb7126c063c34d63966733988411f72dfcb2294maczniak /* give this client a unique number if needed */
8bb7126c063c34d63966733988411f72dfcb2294maczniak client->number = crServerGenerateID(&cr_server.idsPool.freeClientID);
8bb7126c063c34d63966733988411f72dfcb2294maczniak crDebug("Adding client %p to the run queue", client);
8bb7126c063c34d63966733988411f72dfcb2294maczniak crError("CRServer: client %p already in the queue!", client);
8bb7126c063c34d63966733988411f72dfcb2294maczniak /* adding to empty queue */
8bb7126c063c34d63966733988411f72dfcb2294maczniak /* insert in doubly-linked list */
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh crDebug("Deleting client %p (%d msgs left)", client, crNetNumMessages(client->conn));
0d0ba3a410038e179b695446bb149cce6264e0abnd crDebug("Delay destroying client: message still pending");
0d0ba3a410038e179b695446bb149cce6264e0abnd /* this should never happen */
0d0ba3a410038e179b695446bb149cce6264e0abnd crError("CRServer: client %p not found in the queue!", client);
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen /* remove from clients[] array */
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd /* found it */
/* Check if we have context(s) made by this client left, could happen if client side code is lazy */
crFree(q);
crFree(q);
q = q->next;
} while (q != qStart);
return GL_TRUE;
return GL_FALSE;
static RunQueue *
return NULL;
return NULL;
if (all_blocked)
crNetRecv();
if (!block)
return NULL;
crNetRecv();
int opcodeBytes;
const char *data_ptr;
#ifdef VBOXCR_LOGFPS
CRASSERT(cr_server.curClient && cr_server.curClient->conn && cr_server.curClient->conn->id == msg->header.conn_id);
} ClientStatus;
static ClientStatus
unsigned int len;
* seen in the "multitilesort.conf" configuration), the
CRASSERT(cr_server.currentWindow == clientWindow);
return CLIENT_NEXT;
* Check if client/connection is gone
return CLIENT_GONE;
return CLIENT_MORE;
return CLIENT_NEXT;
crServerServiceClients(void)
RunQueue *q;
(void) len;
case CR_MESSAGE_NEWCLIENT:
msg->header.type ); */