int burst;
struct clock burstTime;
struct clock retryTime;
-extern int rx_initSendWindow, rx_initReceiveWindow;
-extern int rxi_nSendFrags, rxi_nRecvFrags;
-extern rx_intentionallyDroppedPacketsPer100;
-extern int (*rxi_syscallp) ();
FILE *debugFile;
int timeout;
struct clock waitTime, computeTime;
struct rx_call *call;
int err = 0;
int nCalls = 1, nBytes = 1;
- int bufferSize = 2000;
+ int bufferSize = 4000000;
char *buffer;
char *sendFile = 0;
int setFD = 0;
+ int jumbo = 0;
#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV)
setlinebuf(stdout);
while (argc && **argv == '-') {
if (strcmp(*argv, "-silent") == 0)
print = 0;
+ if (strcmp(*argv, "-jumbo") == 0)
+ jumbo = 1;
else if (strcmp(*argv, "-nc") == 0)
nCalls = atoi(*++argv), argc--;
else if (strcmp(*argv, "-nb") == 0)
nBytes = atoi(*++argv), argc--;
- else if (strcmp(*argv, "-npb") == 0)
+ else if (strcmp(*argv, "-np") == 0)
rx_nPackets = atoi(*++argv), argc--;
else if (!strcmp(*argv, "-nsf"))
rxi_nSendFrags = atoi(*++argv), argc--;
logstdout = 1;
else if (strcmp(*argv, "-eventlog") == 0)
eventlog = 1;
- else if (strcmp(*argv, "-drop") == 0)
+ else if (strcmp(*argv, "-drop") == 0) {
+#ifdef RXDEBUG
rx_intentionallyDroppedPacketsPer100 = atoi(*++argv), argc--;
+#else
+ fprintf(stderr, "ERROR: Compiled without RXDEBUG\n");
+#endif
+ }
else if (strcmp(*argv, "-burst") == 0) {
burst = atoi(*++argv), argc--;
burstTime.sec = atoi(*++argv), argc--;
printf("Can't initialize winsock.\n");
exit(1);
}
+ rx_EnableHotThread();
#endif
+ rx_SetUdpBufSize(256 * 1024);
+
+ if (!jumbo)
+ rx_SetNoJumbo();
+
hostent = gethostbyname(hostname);
if (!hostent)
Abort("host %s not found", hostname);
IOMGR_Sleep(t.tv_sec);
#endif
}
+ if (debugFile)
+ rx_PrintPeerStats(debugFile, rx_PeerOf(conn));
+ rx_PrintPeerStats(stdout, rx_PeerOf(conn));
}
- if (debugFile)
- rx_PrintPeerStats(debugFile, rx_PeerOf(conn));
- rx_PrintPeerStats(stdout, rx_PeerOf(conn));
}
Quit("testclient: done!\n");
}
-SendFile(file, conn)
+int SendFile(file, conn)
char *file;
struct rx_connection *conn;
{
}
}
close(fd);
+
+ return(0);
}
Abort(msg, a, b, c, d, e)
exit(1);
}
-Quit(msg, a, b, c, d, e)
+Quit(char *msg, int a, int b, int c, int d, int e)
{
printf((char *)msg, a, b, c, d, e);
printf("\n");
int error; /* Return this error number on a call */
int print = 0, eventlog = 0, rxlog = 0;
-extern rx_intentionallyDroppedPacketsPer100;
-extern char rxi_tracename[];
-extern int rx_initSendWindow, rx_initReceiveWindow;
-extern int rxi_nSendFrags, rxi_nRecvFrags;
-extern int (*rxi_syscallp) ();
struct clock computeTime, waitTime;
FILE *debugFile;
char *rcvFile;
int logstdout = 0;
+void Abort(char *msg, int a, int b, int c, int d, int e);
+void Quit(char *msg, int a, int b, int c, int d, int e);
+void OpenFD(int n);
+int FileRequest(struct rx_call *call);
+int SimpleRequest(struct rx_call *call);
+
void
intSignal(int ignore)
{
- Quit("Interrupted");
+ Quit("Interrupted",0,0,0,0,0);
}
void
{
static int quitCount = 0;
if (++quitCount > 1)
- Quit("rx_ctest: second quit signal, aborting");
+ Quit("rx_ctest: second quit signal, aborting",0,0,0,0,0);
rx_debugFile = debugFile = fopen("rx_stest.db", "w");
if (debugFile)
rx_PrintStats(debugFile);
}
-int SimpleRequest(), FileRequest();
-
#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV)
int
test_syscall(a3, a4, a5)
struct rx_securityClass *(secobjs[1]);
int err = 0;
int setFD = 0;
+ int jumbo = 0;
#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV)
setlinebuf(stdout);
while (argc && **argv == '-') {
if (strcmp(*argv, "-verbose") == 0)
print = 1;
+ else if (strcmp(*argv, "-jumbo") == 0)
+ jumbo = 1;
else if (strcmp(*argv, "-rxlog") == 0)
rxlog = 1;
+#if defined(RXDEBUG) && !defined(AFS_NT40_ENV)
else if (strcmp(*argv, "-trace") == 0)
strcpy(rxi_tracename, *(++argv)), argc--;
+#endif
else if (strcmp(*argv, "-logstdout") == 0)
logstdout = 1;
else if (strcmp(*argv, "-eventlog") == 0)
rx_initReceiveWindow = atoi(*++argv), argc--;
else if (strcmp(*argv, "-file") == 0)
rcvFile = *++argv, argc--;
- else if (strcmp(*argv, "-drop") == 0)
+ else if (strcmp(*argv, "-drop") == 0) {
+#ifdef RXDEBUG
rx_intentionallyDroppedPacketsPer100 = atoi(*++argv), argc--;
+#else
+ fprintf(stderr, "ERROR: Compiled without RXDEBUG\n");
+#endif
+ }
else if (strcmp(*argv, "-err") == 0)
error = atoi(*++argv), argc--;
else if (strcmp(*argv, "-compute") == 0) {
argv++, argc--;
}
if (err || argc != 0)
- Quit("usage: rx_stest [-silent] [-rxlog] [-eventlog]");
+ Quit("usage: rx_stest [-silent] [-rxlog] [-eventlog]",0,0,0,0,0);
if (rxlog || eventlog) {
if (logstdout)
else
debugFile = fopen("rx_stest.db", "w");
if (debugFile == NULL)
- Quit("Couldn't open rx_stest.db");
+ Quit("Couldn't open rx_stest.db",0,0,0,0,0);
if (rxlog)
rx_debugFile = debugFile;
if (eventlog)
if (setFD > 0)
OpenFD(setFD);
+
+#ifdef AFS_NT40_ENV
+ rx_EnableHotThread();
+#endif
+
+ if (!jumbo)
+ rx_SetNoJumbo();
+
+ rx_SetUdpBufSize(256 * 1024);
+
if (rx_Init(htons(2500)) != 0) {
printf("RX initialization failed, exiting.\n");
exit(1);
1, /*Execute request */
rcvFile ? FileRequest : SimpleRequest);
if (!service)
- Abort("rx_NewService returned 0!\n");
+ Abort("rx_NewService returned 0!\n",0,0,0,0,0);
+
+ rx_SetMinProcs(service, 2);
+ rx_SetMaxProcs(service, 100);
+ rx_SetCheckReach(service, 1);
+
printf("Using %d packet buffers\n", rx_nPackets);
rx_StartServer(1);
}
-SimpleRequest(call)
- struct rx_call *call;
+static char buf[2000000];
+
+int SimpleRequest(struct rx_call *call)
{
int n;
- int nbytes = 1000;
- char buf[1000];
+ int nbytes = sizeof(buf);
while ((n = rx_Read(call, buf, nbytes)) > 0)
if (print)
printf("stest: Received %d bytes\n", n);
if (!rx_Error(call)) {
/* Fake compute time (use select to lock out everything) */
- struct timeval t;
+#ifndef AFS_NT40_ENV
+ struct timeval t;
+#endif
if (!clock_IsZero(&computeTime)) {
- t.tv_sec = computeTime.sec;
- t.tv_usec = computeTime.usec;
#ifdef AFS_NT40_ENV
- Sleep(t.tv_sec);
+ Sleep(computeTime.sec * 1000 + 100 * computeTime.usec);
#else
+ t.tv_sec = computeTime.sec;
+ t.tv_usec = computeTime.usec;
+#ifdef AFS_PTHREAD_ENV
if (select(0, 0, 0, 0, &t) != 0)
- Quit("Select didn't return 0");
+ Quit("Select didn't return 0",0,0,0,0,0);
+#else
+ IOMGR_Sleep(t.tv_sec);
+#endif
#endif
}
/* Then wait time (use iomgr_select to allow rx to run) */
if (!clock_IsZero(&waitTime)) {
+#ifdef AFS_NT40_ENV
+ Sleep(waitTime.sec * 1000 + 100 * waitTime.usec);
+#else
t.tv_sec = waitTime.sec;
t.tv_usec = waitTime.usec;
#ifdef AFS_PTHREAD_ENV
#else
IOMGR_Sleep(t.tv_sec);
#endif
+#endif
}
rx_Write(call, "So long, and thanks for all the fish!\n",
strlen("So long, and thanks for all the fish!\n"));
return 0;
}
-FileRequest(call)
- struct rx_call *call;
+int
+FileRequest(struct rx_call *call)
{
int fd;
struct stat status;
fd = open(rcvFile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (fd < 0) {
perror("open");
- return;
+ return -1;
}
fstat(fd, &status);
#ifdef AFS_NT40_ENV
while (nbytes = rx_Read(call, buffer, blockSize)) {
if (write(fd, buffer, nbytes) != nbytes) {
perror("writev");
- Abort("Write Failed.\n");
+ Abort("Write Failed.\n",0,0,0,0,0);
break;
}
}
return 0;
}
-Abort(msg, a, b, c, d, e)
+void
+Abort(char *msg, int a, int b, int c, int d, int e)
{
printf((char *)msg, a, b, c, d, e);
printf("\n");
abort();
}
-Quit(msg, a, b, c, d, e)
+void
+Quit(char *msg, int a, int b, int c, int d, int e)
{
printf((char *)msg, a, b, c, d, e);
printf("\n");
* Open file descriptors until file descriptor n or higher is returned.
*/
#include <sys/stat.h>
-OpenFD(n)
- int n;
+void
+OpenFD(int n)
{
int i;
struct stat sbuf;