From 6807d4fd4a02839b63ec543e89b1f542c8a52fa9 Mon Sep 17 00:00:00 2001 From: Mark Rivers Date: Tue, 5 Nov 2024 12:38:19 -0600 Subject: [PATCH] Change cast to work on Windows where timeval is defined differently from Linux --- asyn/drvAsynSerial/drvAsynIPPort.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/asyn/drvAsynSerial/drvAsynIPPort.c b/asyn/drvAsynSerial/drvAsynIPPort.c index da9e849c..85906397 100644 --- a/asyn/drvAsynSerial/drvAsynIPPort.c +++ b/asyn/drvAsynSerial/drvAsynIPPort.c @@ -515,18 +515,15 @@ connectIt(void *drvPvt, asynUser *pasynUser) struct timeval saveTV, connectTV; socklen_t svlen = sizeof saveTV; pasynManager->getAutoConnectTimeout(&connectTimeout); - connectTV.tv_sec = (time_t)connectTimeout; - connectTV.tv_usec = (suseconds_t)((connectTimeout - connectTV.tv_sec)*1000000); - asynPrint(pasynUser, ASYN_TRACE_ERROR, "Calling setsockopt SO_SNDTIMEO tv_sec=%d tv_usec=%d\n", connectTV.tv_sec, connectTV.tv_usec); + connectTV.tv_sec = (long)connectTimeout; + connectTV.tv_usec = (long)((connectTimeout - connectTV.tv_sec)*1000000); if (getsockopt (fd, SOL_SOCKET, SO_SNDTIMEO, (char *)&saveTV, &svlen) < 0) { asynPrint(pasynUser, ASYN_TRACE_ERROR, "connectIt, error calling getsockopt for SO_RECVTIMEO: %s\n", strerror(SOCKERRNO)); } if (setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (char *)&connectTV, sizeof connectTV) < 0) { asynPrint(pasynUser, ASYN_TRACE_ERROR, "connectIt, error calling setsockopt for SO_RECVTIMEO: %s\n", strerror(SOCKERRNO)); } - asynPrint(pasynUser, ASYN_TRACE_ERROR, "connectIt, calling connect()\n"); if (connect(fd, &tty->farAddr.oa.sa, (int)tty->farAddrSize) < 0) { - asynPrint(pasynUser, ASYN_TRACE_ERROR, "connectIt, connect returned error: %s\n", strerror(SOCKERRNO)); epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize, "Can't connect to %s: %s", tty->IPDeviceName, strerror(SOCKERRNO));