git.samba.org
/
rusty
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5728b0f
)
s3: use monotonic clock for time deltas in namequery functions
author
Björn Jacke
<bj@sernet.de>
Mon, 30 Aug 2010 13:46:22 +0000
(15:46 +0200)
committer
Björn Jacke
<bj@sernet.de>
Tue, 31 Aug 2010 08:26:13 +0000
(10:26 +0200)
source3/libsmb/namequery.c
patch
|
blob
|
history
diff --git
a/source3/libsmb/namequery.c
b/source3/libsmb/namequery.c
index c79480f70744f59abcdd5864930cf203c063a2a3..c949d3bcb449bad291009a09f4e2a4afbf992e27 100644
(file)
--- a/
source3/libsmb/namequery.c
+++ b/
source3/libsmb/namequery.c
@@
-261,7
+261,7
@@
NODE_STATUS_STRUCT *node_status_query(int fd,
bool found=False;
int retries = 2;
int retry_time = 2000;
bool found=False;
int retries = 2;
int retry_time = 2000;
- struct time
val tval
;
+ struct time
spec tp
;
struct packet_struct p;
struct packet_struct *p2;
struct nmb_packet *nmb = &p.packet.nmb;
struct packet_struct p;
struct packet_struct *p2;
struct nmb_packet *nmb = &p.packet.nmb;
@@
-297,7
+297,7
@@
NODE_STATUS_STRUCT *node_status_query(int fd,
p.timestamp = time(NULL);
p.packet_type = NMB_PACKET;
p.timestamp = time(NULL);
p.packet_type = NMB_PACKET;
-
GetTimeOfDay(&tval
);
+
clock_gettime_mono(&tp
);
if (!send_packet(&p))
return NULL;
if (!send_packet(&p))
return NULL;
@@
-305,14
+305,14
@@
NODE_STATUS_STRUCT *node_status_query(int fd,
retries--;
while (1) {
retries--;
while (1) {
- struct time
val tval
2;
-
GetTimeOfDay(&tval
2);
- if (T
valDiff(&tval,&tval
2) > retry_time) {
+ struct time
spec tp
2;
+
clock_gettime_mono(&tp
2);
+ if (T
specDiff(&tp,&tp
2) > retry_time) {
if (!retries)
break;
if (!found && !send_packet(&p))
return NULL;
if (!retries)
break;
if (!found && !send_packet(&p))
return NULL;
-
GetTimeOfDay(&tval
);
+
clock_gettime_mono(&tp
);
retries--;
}
retries--;
}
@@
-655,7
+655,7
@@
struct sockaddr_storage *name_query(int fd,
bool found=false;
int i, retries = 3;
int retry_time = bcast?250:2000;
bool found=false;
int i, retries = 3;
int retry_time = bcast?250:2000;
- struct time
val tval
;
+ struct time
spec tp
;
struct packet_struct p;
struct packet_struct *p2;
struct nmb_packet *nmb = &p.packet.nmb;
struct packet_struct p;
struct packet_struct *p2;
struct nmb_packet *nmb = &p.packet.nmb;
@@
-705,7
+705,7
@@
struct sockaddr_storage *name_query(int fd,
p.timestamp = time(NULL);
p.packet_type = NMB_PACKET;
p.timestamp = time(NULL);
p.packet_type = NMB_PACKET;
-
GetTimeOfDay(&tval
);
+
clock_gettime_mono(&tp
);
if (!send_packet(&p))
return NULL;
if (!send_packet(&p))
return NULL;
@@
-713,15
+713,15
@@
struct sockaddr_storage *name_query(int fd,
retries--;
while (1) {
retries--;
while (1) {
- struct time
val tval
2;
+ struct time
spec tp
2;
-
GetTimeOfDay(&tval
2);
- if (T
valDiff(&tval,&tval
2) > retry_time) {
+
clock_gettime_mono(&tp
2);
+ if (T
specDiff(&tp,&tp
2) > retry_time) {
if (!retries)
break;
if (!found && !send_packet(&p))
return NULL;
if (!retries)
break;
if (!found && !send_packet(&p))
return NULL;
-
GetTimeOfDay(&tval
);
+
clock_gettime_mono(&tp
);
retries--;
}
retries--;
}