aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYury Yaroshevich <yura.yaroshevich@gmail.com>2020-05-25 12:17:05 +0300
committerGitHub <noreply@github.com>2020-05-25 11:17:05 +0200
commit85c8e5066caf77f91393f05128bb9971c9998abd (patch)
treeca0ca5f42865a23d2b55788f1ad5695ea3ddee42
parent3fbc9fc07e73e4f82b3be85b2fe354052f7c6b70 (diff)
downloadusrsctp-85c8e5066caf77f91393f05128bb9971c9998abd.tar.gz
Adjust `usrsctp_handle_timers` signature and implementation (#470)
* usrsctp_handle_timers should accept mcecs as argument. * Renamed argument to have more clear name. * Renamed function to match behavior.
-rw-r--r--programs/st_client.c7
-rwxr-xr-xusrsctplib/user_socket.c4
-rw-r--r--usrsctplib/usrsctp.h2
3 files changed, 7 insertions, 6 deletions
diff --git a/programs/st_client.c b/programs/st_client.c
index 3abcca4..5e2f87c 100644
--- a/programs/st_client.c
+++ b/programs/st_client.c
@@ -68,9 +68,10 @@ static int connecting = 0;
static int finish = 0;
static unsigned int
-get_tick_count(void)
+get_milliseconds_count(void)
{
#ifdef _WIN32
+ // obtain number of milliseconds since system started
return GetTickCount();
#else
struct timeval tv;
@@ -92,9 +93,9 @@ handle_events(int sock, struct socket* s, void* sconn_addr)
fd_set rfds;
struct timeval tv;
- unsigned next_fire_time = get_tick_count();
+ unsigned next_fire_time = get_milliseconds_count();
unsigned last_fire_time = next_fire_time;
- unsigned now = get_tick_count();
+ unsigned now = get_milliseconds_count();
int wait_time;
while (!finish) {
diff --git a/usrsctplib/user_socket.c b/usrsctplib/user_socket.c
index c2fb040..811e061 100755
--- a/usrsctplib/user_socket.c
+++ b/usrsctplib/user_socket.c
@@ -3543,9 +3543,9 @@ usrsctp_conninput(void *addr, const void *buffer, size_t length, uint8_t ecn_bit
return;
}
-void usrsctp_handle_timers(uint32_t delta)
+void usrsctp_handle_timers(uint32_t elapsed_milliseconds)
{
- sctp_handle_tick(delta);
+ sctp_handle_tick(MSEC_TO_TICKS(elapsed_milliseconds));
}
int
diff --git a/usrsctplib/usrsctp.h b/usrsctplib/usrsctp.h
index 10a1239..fea2aaf 100644
--- a/usrsctplib/usrsctp.h
+++ b/usrsctplib/usrsctp.h
@@ -1046,7 +1046,7 @@ usrsctp_get_events(struct socket *so);
void
-usrsctp_handle_timers(uint32_t delta);
+usrsctp_handle_timers(uint32_t elapsed_milliseconds);
#define SCTP_DUMP_OUTBOUND 1
#define SCTP_DUMP_INBOUND 0