Commit a08fa1d6 authored by rna's avatar rna

Merge branch 'develop' into feature/congestionControl

parents d44b6c69 fee56a70
Pipeline #2539 passed with stages
in 1 minute and 9 seconds
......@@ -437,6 +437,8 @@ int PrrtSocket_close(PrrtSocket *s) {
uint32_t PrrtSocket_get_sock_opt(PrrtSocket *s, const char *name) {
if (strcmp(name, "targetdelay") == 0) {
return PrrtApplicationConstraints_get_target_delay(s->applicationConstraints);
} else if (strcmp(name, "connected") == 0) {
return (s->receiver != NULL) ? 1 : 0;
} else if (strcmp(name, "maximum_payload_size") == 0) {
return s->maximum_payload_size;
} else {
......
......@@ -135,7 +135,6 @@ class PrrtCodingConfiguration:
cdef class PrrtSocket:
cdef cprrt.PrrtSocket* _c_socket
_epoch = datetime.datetime.utcfromtimestamp(0)
_connected = False
def __cinit__(self, address, maximum_payload_size = 1400, target_delay = 1, thread_pinning = False):
host, port = address
......@@ -203,10 +202,9 @@ cdef class PrrtSocket:
host, port = address
cdef bytes encodedHost = host.encode("utf-8")
cprrt.PrrtSocket_connect(self._c_socket, encodedHost, port)
self._connected = True
def send(self, data):
if not self._connected:
if cprrt.PrrtSocket_get_sock_opt(self._c_socket, "connected") == 0:
raise Exception("PrrtSocket must be connected first, before data can be sent.")
maximum_payload_size = cprrt.PrrtSocket_get_sock_opt(self._c_socket, "maximum_payload_size")
data_len = len(data)
......
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