Commit 1a02ced7 authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Propagate ETIMEDOUT.

parent 135abbab
Pipeline #1939 passed with stages
in 1 minute and 24 seconds
......@@ -305,6 +305,9 @@ int32_t PrrtSocket_receive_asap_timedwait(PrrtSocket *s, void *buf_ptr, struct t
check(s->isSender == false, "Cannot receive on sender socket.")
PrrtPacket *packet = PrrtPacketDeliveryStore_get_packet_timedwait(s->packetDeliveryStore, 0, MAX_TIMESTAMP, deadline);
if (packet == NULL && errno == ETIMEDOUT) {
return -1 * ETIMEDOUT;
}
return deliver_packet(s, buf_ptr, packet);
error:
......@@ -355,6 +358,10 @@ int32_t PrrtSocket_receive_ordered_timedwait(PrrtSocket *s, void *buf_ptr, prrtT
PrrtPacket *packet = PrrtPacketDeliveryStore_get_packet_timedwait(s->packetDeliveryStore, now - time_window_us,
now + time_window_us, deadline);
if (packet == NULL && errno == ETIMEDOUT) {
return -1 * ETIMEDOUT;
}
return deliver_packet(s, buf_ptr, packet);
error:
PERROR("There was a failure while receiving from socket.%s", "");
......
......@@ -31,7 +31,11 @@ PrrtPacket * PrrtPacketDeliveryStore_get_packet_timedwait(PrrtPacketDeliveryStor
packet = PrrtPacketDeliveryStore_get_packet(q, start, stop);
if (!packet && !atomic_load_explicit(&q->closing, memory_order_acquire)) {
pthread_cond_timedwait(&q->wait_for_data, &q->lock, deadline);
int res = pthread_cond_timedwait(&q->wait_for_data, &q->lock, deadline);
if (res == ETIMEDOUT) {
errno = ETIMEDOUT;
return NULL;
}
packet = PrrtPacketDeliveryStore_get_packet(q, start, stop);
}
......
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