summaryrefslogtreecommitdiff
path: root/pr/tests/servr_ku.c
diff options
context:
space:
mode:
Diffstat (limited to 'pr/tests/servr_ku.c')
-rw-r--r--pr/tests/servr_ku.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/pr/tests/servr_ku.c b/pr/tests/servr_ku.c
index c120ad01..13e8ee15 100644
--- a/pr/tests/servr_ku.c
+++ b/pr/tests/servr_ku.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.
**
**
@@ -91,7 +91,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);
@@ -135,7 +135,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,
@@ -148,7 +148,7 @@ WorkerThreadFunc(void *_listenSock)
}
if (debug_mode) DPRINTF("\tServer accepted connection (%d bytes)\n", bytesRead);
-
+
PR_AtomicIncrement(&workerThreadsBusy);
if (workerThreadsBusy == workerThreads) {
PR_Lock(workerThreadsLock);
@@ -173,13 +173,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);
@@ -189,12 +189,12 @@ 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);
@@ -345,7 +345,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) {
@@ -355,10 +355,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);
@@ -370,13 +370,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;
}
@@ -385,7 +385,7 @@ ClientThreadFunc(void *unused)
}
PR_Close(clientSocket);
-
+
PR_AtomicDecrement(&numRequests);
}
@@ -410,7 +410,7 @@ RunClients(void)
for (index=0; index<_clients; index++) {
PRThread *clientThread;
-
+
clientThread = PR_CreateThread(
PR_USER_THREAD,
ClientThreadFunc,
@@ -529,7 +529,7 @@ int main(int argc, char **argv)
printf("Enter size of server data : \n");
scanf("%d", &_server_data);
}
- else
+ else
{
_iterations = 7;
_clients = 7;
@@ -538,9 +538,9 @@ int main(int argc, char **argv)
}
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);
@@ -554,7 +554,7 @@ int main(int argc, char **argv)
Measure(do_workKU, "server loop kernel/user");
PR_Cleanup();
- if(failed_already)
+ if(failed_already)
return 1;
else
return 0;