/*********************************************************
- * Copyright (C) 2011,2014-2017,2019-2021 VMware, Inc. All rights reserved.
+ * Copyright (C) 2011,2014-2017,2019-2022 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
int timeoutMS);
int (*doOneMsg)(AsyncSocket *s, Bool read, int timeoutMS);
int (*waitForConnection)(AsyncSocket *s, int timeoutMS);
- int (*waitForReadMultiple)(AsyncSocket **asock, int numSock, int timeoutMS,
- int *outIdx);
+ int (*waitForReadMultiple)(AsyncSocket **asock, size_t numSock,
+ int timeoutMS, int *outIdx);
int (*peek)(AsyncSocket *asock, void *buf, int len, void *cb, void *cbData);
/*
static int AsyncTCPSocketSendBlocking(AsyncSocket *s, void *buf, int len,
int *sent, int timeoutMS);
static int AsyncTCPSocketDoOneMsg(AsyncSocket *s, Bool read, int timeoutMS);
-static int AsyncTCPSocketWaitForReadMultiple(AsyncSocket **asock, int numSock,
+static int AsyncTCPSocketWaitForReadMultiple(AsyncSocket **asock, size_t numSock,
int timeoutMS, int *outIdx);
static int AsyncTCPSocketSetOption(AsyncSocket *asyncSocket,
AsyncSocketOpts_Layer layer,
static int
AsyncTCPSocketPollWork(AsyncTCPSocket **asock, // IN:
- int numSock, // IN:
+ size_t numSock, // IN:
void *p, // IN:
Bool read, // IN:
int timeoutMS, // IN:
struct fd_set rwfds;
struct fd_set exceptfds;
#endif
- int i;
+ size_t i;
int retval;
ASSERT(outAsock != NULL && *outAsock == NULL && asock != NULL &&
- numSock > 0);
+ numSock != 0);
for (i = 0; i < numSock; i++) {
if (read && SSL_Pending(asock[i]->sslSock)) {
retval = poll(pfd, numSock, timeoutMS);
AsyncTCPSocketLock(parentSock);
} else {
- for (i = numSock - 1; i >= 0; i--) {
+ for (i = numSock; i-- > 0; ) {
AsyncTCPSocketUnlock(asock[i]);
}
retval = poll(pfd, numSock, timeoutMS);
&exceptfds, timeoutMS >= 0 ? &tv : NULL);
AsyncTCPSocketLock(parentSock);
} else {
- for (i = numSock - 1; i >= 0; i--) {
+ for (i = numSock; i-- > 0; ) {
AsyncTCPSocketUnlock(asock[i]);
}
retval = select(1, read ? &rwfds : NULL, read ? NULL : &rwfds,
#else
void *p = NULL;
#endif
- int numSock = 0;
+ size_t numSock = 0;
if (read && s->fd == -1) {
if (!s->listenAsock4 && !s->listenAsock6) {
static int
AsyncTCPSocketWaitForReadMultiple(AsyncSocket **asock, // IN:
- int numSock, // IN:
+ size_t numSock, // IN:
int timeoutMS, // IN:
int *outIdx) // OUT:
{
- int i;
+ size_t i;
int err;
AsyncTCPSocket *outAsock = NULL;
#ifndef _WIN32
}
err = AsyncTCPSocketPollWork((AsyncTCPSocket **)asock, numSock, p, TRUE,
timeoutMS, NULL, &outAsock);
- for (i = numSock - 1; i >= 0; i--) {
+ for (i = numSock; i-- > 0; ) {
AsyncTCPSocket *tcpAsock = TCPSocket(asock[i]);
if (outAsock == tcpAsock) {
*outIdx = i;