summaryrefslogtreecommitdiff
path: root/pr/tests/server_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'pr/tests/server_test.c')
-rw-r--r--pr/tests/server_test.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/pr/tests/server_test.c b/pr/tests/server_test.c
index b1750ec2..3840c828 100644
--- a/pr/tests/server_test.c
+++ b/pr/tests/server_test.c
@@ -8,7 +8,7 @@
** This server simulates a server running in loopback mode.
**
** The idea is that a single server is created. The server initially creates
-** a number of worker threads. Then, with the server running, a number of
+** a number of worker threads. Then, with the server running, a number of
** clients are created which start requesting service from the server.
**
**
@@ -17,7 +17,7 @@
** The debug mode will print all of the printfs associated with this test.
** The regress mode will be the default mode. Since the regress tool limits
** the output to a one line status:PASS or FAIL,all of the printf statements
-** have been handled with an if (debug_mode) statement.
+** have been handled with an if (debug_mode) statement.
***********************************************************************/
/***********************************************************************
@@ -73,12 +73,12 @@ PRCondVar *ServerStateCV;
** OUTPUTS: None
** RETURN: None
** SIDE EFFECTS:
-**
+**
** RESTRICTIONS:
** None
** MEMORY: NA
** ALGORITHM: Determine what the status is and print accordingly.
-**
+**
***********************************************************************/
@@ -126,7 +126,7 @@ WaitServerState(char *waiter, PRInt32 state)
PR_WaitCondVar(ServerStateCV, PR_INTERVAL_NO_TIMEOUT);
rv = ServerState;
- if (debug_mode) DPRINTF("\t%s resuming from wait for state %d; state now %d\n",
+ if (debug_mode) DPRINTF("\t%s resuming from wait for state %d; state now %d\n",
waiter, state, ServerState);
PR_Unlock(ServerStateCVLock);
@@ -170,7 +170,7 @@ WorkerThreadFunc(void *_listenSock)
if (debug_mode) DPRINTF("\tServer thread going into accept\n");
- bytesRead = PR_AcceptRead(listenSock,
+ bytesRead = PR_AcceptRead(listenSock,
&newSock,
&rAddr,
dataBuf,
@@ -183,7 +183,7 @@ WorkerThreadFunc(void *_listenSock)
}
if (debug_mode) DPRINTF("\tServer accepted connection (%d bytes)\n", bytesRead);
-
+
PR_AtomicIncrement(&workerThreadsBusy);
if (workerThreadsBusy == workerThreads) {
PR_Lock(workerThreadsLock);
@@ -208,13 +208,13 @@ WorkerThreadFunc(void *_listenSock)
}
PR_Unlock(workerThreadsLock);
}
-
+
bytesToRead -= bytesRead;
while (bytesToRead) {
- bytesRead = PR_Recv(newSock,
- dataBuf,
- bytesToRead,
- 0,
+ bytesRead = PR_Recv(newSock,
+ dataBuf,
+ bytesToRead,
+ 0,
PR_INTERVAL_NO_TIMEOUT);
if (bytesRead < 0) {
if (debug_mode) printf("\tServer error receiving data (%d)\n", bytesRead);
@@ -224,16 +224,16 @@ WorkerThreadFunc(void *_listenSock)
}
bytesWritten = PR_Send(newSock,
- sendBuf,
- bytesToWrite,
- 0,
+ sendBuf,
+ bytesToWrite,
+ 0,
PR_INTERVAL_NO_TIMEOUT);
if (bytesWritten != _server_data) {
- if (debug_mode) printf("\tError sending data to client (%d, %d)\n",
+ if (debug_mode) printf("\tError sending data to client (%d, %d)\n",
bytesWritten, PR_GetOSError());
} else {
if (debug_mode) DPRINTF("\tServer sent %d bytes\n", bytesWritten);
- }
+ }
PR_Close(newSock);
PR_AtomicDecrement(&workerThreadsBusy);
@@ -380,7 +380,7 @@ ClientThreadFunc(void *unused)
if (debug_mode) DPRINTF("\tClient connecting\n");
- rv = PR_Connect(clientSocket,
+ rv = PR_Connect(clientSocket,
&serverAddr,
PR_INTERVAL_NO_TIMEOUT);
if (!clientSocket) {
@@ -390,10 +390,10 @@ ClientThreadFunc(void *unused)
if (debug_mode) DPRINTF("\tClient connected\n");
- rv = PR_Send(clientSocket,
- sendBuf,
- _client_data,
- 0,
+ rv = PR_Send(clientSocket,
+ sendBuf,
+ _client_data,
+ 0,
PR_INTERVAL_NO_TIMEOUT);
if (rv != _client_data) {
if (debug_mode) printf("Client error sending data (%d)\n", rv);
@@ -405,13 +405,13 @@ ClientThreadFunc(void *unused)
bytesNeeded = _server_data;
while(bytesNeeded) {
- rv = PR_Recv(clientSocket,
- recvBuf,
- bytesNeeded,
- 0,
+ rv = PR_Recv(clientSocket,
+ recvBuf,
+ bytesNeeded,
+ 0,
PR_INTERVAL_NO_TIMEOUT);
if (rv <= 0) {
- if (debug_mode) printf("Client error receiving data (%d) (%d/%d)\n",
+ if (debug_mode) printf("Client error receiving data (%d) (%d/%d)\n",
rv, (_server_data - bytesNeeded), _server_data);
break;
}
@@ -420,7 +420,7 @@ ClientThreadFunc(void *unused)
}
PR_Close(clientSocket);
-
+
PR_AtomicDecrement(&numRequests);
}
@@ -445,7 +445,7 @@ RunClients(void)
for (index=0; index<_clients; index++) {
PRThread *clientThread;
-
+
clientThread = PR_CreateThread(
PR_USER_THREAD,
ClientThreadFunc,
@@ -583,7 +583,7 @@ int main(int argc, char **argv)
printf("Enter size of server data : \n");
scanf("%d", &_server_data);
}
- else
+ else
{
_iterations = 10;
@@ -591,11 +591,11 @@ int main(int argc, char **argv)
_client_data = 10;
_server_data = 10;
}
-
+
if (debug_mode) {
- printf("\n\n%d iterations with %d client threads.\n",
+ printf("\n\n%d iterations with %d client threads.\n",
_iterations, _clients);
- printf("Sending %d bytes of client data and %d bytes of server data\n",
+ printf("Sending %d bytes of client data and %d bytes of server data\n",
_client_data, _server_data);
}
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
@@ -605,11 +605,11 @@ int main(int argc, char **argv)
ServerStateCV = PR_NewCondVar(ServerStateCVLock);
Measure(do_workUU, "server loop user/user");
- #if 0
+ #if 0
Measure(do_workUK, "server loop user/kernel");
Measure(do_workKU, "server loop kernel/user");
Measure(do_workKK, "server loop kernel/kernel");
- #endif
+ #endif
PR_Cleanup();