char *buf = data->state.buffer;
ssize_t nread;
struct TELNET *tn;
+ struct timeval now; /* current time */
code = init_telnet(conn);
if(code)
keepfd = readfd;
while (keepon) {
+ struct timeval interval;
+
readfd = keepfd; /* set this every lap in the loop */
+ interval.tv_sec = 1;
+ interval.tv_usec = 0;
- switch (select (sockfd + 1, &readfd, NULL, NULL, NULL)) {
+ switch (select (sockfd + 1, &readfd, NULL, NULL, &interval)) {
case -1: /* error, stop reading */
keepon = FALSE;
continue;
}
}
}
+ if(data->set.timeout) {
+ now = Curl_tvnow();
+ if(Curl_tvdiff(now, conn->created)/1000 >= data->set.timeout) {
+ failf(data, "Time-out");
+ code = CURLE_OPERATION_TIMEOUTED;
+ keepon = FALSE;
+ }
+ }
}
#endif
/* mark this as "no further transfer wanted" */
- return Curl_Transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
+ Curl_Transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
+
+ return code;
}
/*