Commit 6233d717 authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Improve getter and setter for target delay to use underlying socket.

parent b3d7dfa7
Pipeline #804 passed with stages
in 57 seconds
......@@ -118,6 +118,7 @@ cdef extern from "proto/socket.h":
int PrrtSocket_send(PrrtSocket *sock_ptr, const uint8_t *data, const size_t data_len)
int32_t PrrtSocket_recv(PrrtSocket *sock_ptr, void *buf_ptr) 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)
cdef extern from "util/bptree.h":
ctypedef struct BPTreeNode:
......@@ -287,6 +287,16 @@ int PrrtSocket_close(PrrtSocket *sock_ptr) {
return -1;
uint32_t PrrtSocket_get_sock_opt(PrrtSocket *sock_ptr, const char *name)
if(strcmp(name, "targetdelay") == 0) {
return PrrtApplicationConstraints_get_target_delay(sock_ptr->applicationConstraints);
} else {
PERROR("Unknwon property %s", name);
return 0;
bool PrrtSocket_set_sock_opt(PrrtSocket *sock_ptr, const char *name, const uint32_t value)
if(strcmp(name, "targetdelay") == 0) {
......@@ -66,6 +66,7 @@ typedef struct prrtSocket {
PrrtSocket *PrrtSocket_create(const bool is_sender);
bool PrrtSocket_bind(PrrtSocket *sock_ptr, const char* ipAddress, const uint16_t port);
bool 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);
int PrrtSocket_interrupt(PrrtSocket *sock_ptr);
int PrrtSocket_close(PrrtSocket *sock_ptr);
int PrrtSocket_connect(PrrtSocket *sock_ptr, const char *host, const uint16_t port);
......@@ -67,7 +67,6 @@ cdef extern from "util/list.c":
cdef class PrrtSocket:
cdef cprrt.PrrtSocket* _c_socket
cdef bint isSender
cdef int32_t _targetDelay
def __cinit__(self, port, isSender):
self._c_socket = cprrt.PrrtSocket_create(isSender)
......@@ -76,11 +75,10 @@ cdef class PrrtSocket:
def target_delay(self):
return self._targetDelay
return cprrt.PrrtSocket_get_sock_opt(self._c_socket, "targetdelay")
def target_delay(self, value):
self._targetDelay = value
cprrt.PrrtSocket_set_sock_opt(self._c_socket, "targetdelay", value)
def recv(self):
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