session CHANGE use monotonic clock where possible
Fixes #43
diff --git a/src/io.c b/src/io.c
index f2f8084..30f7a79 100644
--- a/src/io.c
+++ b/src/io.c
@@ -52,7 +52,7 @@
return 0;
}
- nc_gettimespec(&ts_inact_timeout);
+ nc_gettimespec_mono(&ts_inact_timeout);
nc_addtimespec(&ts_inact_timeout, inact_timeout);
do {
switch (session->ti_type) {
@@ -136,7 +136,7 @@
if (r == 0) {
/* nothing read */
usleep(NC_TIMEOUT_STEP);
- nc_gettimespec(&ts_cur);
+ nc_gettimespec_mono(&ts_cur);
if ((nc_difftimespec(&ts_cur, &ts_inact_timeout) < 1) || (nc_difftimespec(&ts_cur, ts_act_timeout) < 1)) {
if (nc_difftimespec(&ts_cur, &ts_inact_timeout) < 1) {
ERR("Session %u: inactive read timeout elapsed.", session->id);
@@ -152,7 +152,7 @@
readd += r;
/* reset inactive timeout */
- nc_gettimespec(&ts_inact_timeout);
+ nc_gettimespec_mono(&ts_inact_timeout);
nc_addtimespec(&ts_inact_timeout, inact_timeout);
}
@@ -282,7 +282,7 @@
return NC_MSG_ERROR;
}
- nc_gettimespec(&ts_act_timeout);
+ nc_gettimespec_mono(&ts_act_timeout);
nc_addtimespec(&ts_act_timeout, NC_READ_ACT_TIMEOUT * 1000);
/* read the message */