Commit ec881e3c authored by Kai Vogelgesang's avatar Kai Vogelgesang

Add python binding to get rtt

parent 52fdeea0
Pipeline #1367 passed with stages
in 1 minute and 19 seconds
......@@ -120,6 +120,7 @@ cdef extern from "proto/socket.h":
int32_t PrrtSocket_timedrecv(PrrtSocket *sock_ptr, void *buf_ptr, const uint32_t wait_time) nogil
bint PrrtSocket_set_sock_opt(PrrtSocket *sock_ptr, const_char *name, const uint32_t value)
uint32_t PrrtSocket_get_sock_opt(PrrtSocket *sock_ptr, const_char *name)
uint32_t PrrtSocket_get_rtt(PrrtSocket *socket)
cdef extern from "util/bptree.h":
ctypedef struct BPTreeNode:
......
......@@ -427,3 +427,9 @@ bool PrrtSocket_cleanup(PrrtSocket *socket) {
}
return true;
}
uint32_t PrrtSocket_get_rtt(PrrtSocket *socket) {
return PrrtChannelStateInformation_get_rtt(socket->csi);
}
......@@ -94,4 +94,6 @@ bool PrrtSocket_cleanup(PrrtSocket *socket);
bool PrrtSocket_closing(PrrtSocket *socket);
uint32_t PrrtSocket_get_rtt(PrrtSocket *socket);
#endif // PRRT_SOCKET_H
......@@ -91,6 +91,13 @@ cdef class PrrtSocket:
raise Exception("Not a sender.")
cprrt.PrrtSocket_set_sock_opt(self._c_socket, "targetdelay", value)
property rtt:
def __get__(self):
if not self.isSender:
raise Exception("Not a sender.")
return cprrt.PrrtSocket_get_rtt(self._c_socket) * 0.000001
def recv(self):
cdef char buffer[65536]
cdef int32_t len
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment