aboutsummaryrefslogtreecommitdiff
path: root/slirp
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-08-25 20:55:44 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-08-25 20:55:44 +0000
commita3504c87cac0248996bc07d732761ad37ba45f34 (patch)
treea60551d7866363169a79ede21c516a3c73fdabb7 /slirp
parentvmdk 3 fixes (diff)
downloadqemu-kvm-a3504c87cac0248996bc07d732761ad37ba45f34.tar.gz
qemu-kvm-a3504c87cac0248996bc07d732761ad37ba45f34.tar.bz2
qemu-kvm-a3504c87cac0248996bc07d732761ad37ba45f34.zip
removed gettimeofday usage
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1053 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'slirp')
-rw-r--r--slirp/tftp.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/slirp/tftp.c b/slirp/tftp.c
index 1bcc70fa5..e50d25539 100644
--- a/slirp/tftp.c
+++ b/slirp/tftp.c
@@ -25,13 +25,13 @@
#include <slirp.h>
struct tftp_session {
- int in_use;
- unsigned char filename[TFTP_FILENAME_MAX];
-
- struct in_addr client_ip;
- u_int16_t client_port;
-
- struct timeval timestamp;
+ int in_use;
+ unsigned char filename[TFTP_FILENAME_MAX];
+
+ struct in_addr client_ip;
+ u_int16_t client_port;
+
+ int timestamp;
};
struct tftp_session tftp_sessions[TFTP_SESSIONS_MAX];
@@ -40,8 +40,8 @@ char *tftp_prefix;
static void tftp_session_update(struct tftp_session *spt)
{
- gettimeofday(&spt->timestamp, 0);
- spt->in_use = 1;
+ spt->timestamp = curtime;
+ spt->in_use = 1;
}
static void tftp_session_terminate(struct tftp_session *spt)
@@ -52,23 +52,17 @@ static void tftp_session_terminate(struct tftp_session *spt)
static int tftp_session_allocate(struct tftp_t *tp)
{
struct tftp_session *spt;
- struct timeval tv;
int k;
- gettimeofday(&tv, 0);
-
for (k = 0; k < TFTP_SESSIONS_MAX; k++) {
spt = &tftp_sessions[k];
- if (!spt->in_use) {
- goto found;
- }
+ if (!spt->in_use)
+ goto found;
/* sessions time out after 5 inactive seconds */
-
- if (tv.tv_sec > (spt->timestamp.tv_sec + 5)) {
- goto found;
- }
+ if ((int)(curtime - spt->timestamp) > 5000)
+ goto found;
}
return -1;