dataReceiver.c 16.4 KB
Newer Older
1
#include <netdb.h>
Andreas Schmidt's avatar
Andreas Schmidt committed
2
#include <stdio.h>
3
#include <arpa/inet.h>
4 5 6
#include "../../defines.h"
#include "../../util/dbg.h"
#include "../../util/common.h"
Andreas Schmidt's avatar
Andreas Schmidt committed
7
#include "../../util/time.h"
Andreas Schmidt's avatar
Andreas Schmidt committed
8
#include "../types/lossStatistics.h"
Andreas Schmidt's avatar
Andreas Schmidt committed
9
#include "../types/block.h"
Andreas Schmidt's avatar
Andreas Schmidt committed
10 11
#include "../clock.h"
#include "../socket.h"
Andreas Schmidt's avatar
Andreas Schmidt committed
12
#include "dataReceiver.h"
13

Andreas Schmidt's avatar
Andreas Schmidt committed
14 15 16 17
static void retrieve_data_packets_for_block(PrrtSocket *sock_ptr,
                                            prrtSequenceNumber_t base_seqno,
                                            uint8_t k,
                                            const PrrtBlock *block) {
18
    List *res = List_create();
Andreas Schmidt's avatar
Andreas Schmidt committed
19 20
    prrtSequenceNumber_t last_seqno = (prrtSequenceNumber_t) (base_seqno + k - 1);
    debug(DEBUG_BLOCK, "Size: %d", PrrtDataPacketStore_size(sock_ptr->dataPacketStore));
21
    PrrtDataPacketStore_remove_range(sock_ptr->dataPacketStore, res, base_seqno,
Andreas Schmidt's avatar
Andreas Schmidt committed
22 23
                                     last_seqno);
    debug(DEBUG_BLOCK, "Retrieve %d packets in range: %u-%u.", List_count(res), base_seqno, last_seqno);
24

25
    LIST_FOREACH(res, first, next, cur) {
Andreas Schmidt's avatar
Andreas Schmidt committed
26 27
        PrrtPacket *packet = cur->value;
        check(PrrtBlock_insert_data_packet((PrrtBlock *) block, packet), "Insert failed!")
28
    }
29 30
    List_destroy(res);
    return;
31
    error:
32
    PERROR("Insert failed.");
33
    List_destroy(res);
34 35
}

Andreas Schmidt's avatar
Andreas Schmidt committed
36 37
static void decode_block(PrrtSocket *sock_ptr, PrrtBlock *block) {
    if (block != NULL && PrrtBlock_decode_ready(block)) {
Andreas Schmidt's avatar
Andreas Schmidt committed
38 39 40 41 42 43 44 45 46 47 48 49 50 51
        bool data_relevant = PrrtDeliveredPacketTable_test_is_block_relevant(sock_ptr->deliveredPacketTable,
                                                                             block->baseSequenceNumber,
                                                                             block->codingParams->n);
        if (data_relevant) {
            check(PrrtBlock_decode(block), "Decoding failed");

            while (List_count(block->dataPackets) > 0) {
                PrrtPacket *pkt = List_shift(block->dataPackets);
                if (PrrtDeliveredPacketTable_test_set_is_number_relevant(sock_ptr->deliveredPacketTable,
                                                                         pkt->sequenceNumber)) {
                    PrrtPacketDeliveryStore_insert(sock_ptr->packetDeliveryStore, pkt);
                } else {
                    PrrtPacket_destroy(pkt);
                }
52 53
            }
        }
54
        PrrtRepairBlockStore_delete(sock_ptr->repairBlockStore, block->baseSequenceNumber);
Andreas Schmidt's avatar
Andreas Schmidt committed
55
        PrrtBlock_destroy(block);
56
    }
Andreas Schmidt's avatar
Andreas Schmidt committed
57 58

    return;
59 60
    error:
    PERROR("Decoding failed.%s", "")
61
}
62

Andreas Schmidt's avatar
Andreas Schmidt committed
63 64 65 66 67 68 69
static bool send_feedback(PrrtSocket *sock_ptr,
                          struct sockaddr_in remote,
                          prrtSequenceNumber_t seqno,
                          prrtTimestamp_t receiveStamp,
                          prrtTimestamp_t sentTimestamp,
                          prrtPacketType_t type) {

70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
    enum XlapTimestampPacketKind kind = ts_data_packet;
    if (type == PACKET_TYPE_DATA) {
        kind = ts_data_packet;
    } else if (type == PACKET_TYPE_REDUNDANCY) {
        kind = ts_redundancy_packet;
    }

    XlapTimeStampCycle(sock_ptr, kind, seqno, SendFeedbackStart);

    prrtFeedback_t feedback = {
            .seqNo = seqno,
            .type = type,
            .receivedTime = receiveStamp,
            .sentTime = sentTimestamp
    };

86 87 88
    prrtTimestamp_t forwardTripTime = (uint32_t) (((int64_t) PrrtClock_get_current_time_us()) +
                                                  (sock_ptr->lastSentTimestamp - sock_ptr->lastReceivedTimestamp));

Andreas Schmidt's avatar
Andreas Schmidt committed
89 90
    PrrtLossStatistics stats = sock_ptr->lossStatistics;

91
    int group_RTT = 0; // TODO: To be determined.
92
    uint32_t local_bottleneck_pace = MAX(PrrtPace_get_effective(sock_ptr->appDeliverPace), PrrtPace_get_effective(sock_ptr->prrtReceivePace));
93 94 95
    PrrtPacket *feedback_pkt_ptr = PrrtPacket_create_feedback_packet(0, sock_ptr->sequenceNumberFeedback++, group_RTT,
                                                                     stats.gapLength, stats.gapCount, stats.burstLength,
                                                                     stats.burstCount, forwardTripTime,
Andreas Schmidt's avatar
Andreas Schmidt committed
96 97 98
                                                                     stats.erasureCount, stats.packetCount,
                                                                     feedback.seqNo, feedback.type,
                                                                     local_bottleneck_pace);
99
    prrtPacketLength_t length = PrrtPacket_size(feedback_pkt_ptr);
100
    void *buf = calloc(1, length);
101
    check_mem(buf);
102

103
    check(PrrtPacket_encode(buf, MAX_PAYLOAD_LENGTH, feedback_pkt_ptr), "Buffer for encoding feedback is too small");
104

Andreas Schmidt's avatar
Andreas Schmidt committed
105
    pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
106
    check(sendto(sock_ptr->socketFd, buf, length, 0, (struct sockaddr *) &remote, sizeof(remote)) ==
107
          length, "Sending feedback failed.");
Andreas Schmidt's avatar
Andreas Schmidt committed
108
    pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
109
    free(buf);
110

111
    PrrtPacket_destroy(feedback_pkt_ptr);
112
    XlapTimeStampCycle(sock_ptr, kind, seqno, SendFeedbackEnd);
113

114
    return true;
115 116

    error:
Andreas Schmidt's avatar
Andreas Schmidt committed
117 118
    if (buf != NULL) { free(buf); }
    if (feedback_pkt_ptr != NULL) { PrrtPacket_destroy(feedback_pkt_ptr); }
119
    return false;
120 121
}

Andreas Schmidt's avatar
Andreas Schmidt committed
122
static void handle_data_packet(PrrtSocket *sock_ptr, PrrtPacket *packet) {
123
    PrrtPacketDataPayload *payload = packet->payload;
124 125 126
    prrtTimestamp_t sentTimestamp = payload->timestamp;
    sock_ptr->lastSentTimestamp = sentTimestamp;
    PrrtClock_update(&sock_ptr->clock, sentTimestamp, payload->groupRTprop_us);
Andreas Schmidt's avatar
Andreas Schmidt committed
127
    debug(DEBUG_DATARECEIVER, "Timeout: %lu", payload->packetTimeout_us);
128

129
    PrrtPacketTimeout *packetTimeout = PrrtPacketTimeout_create(packet);
130
    check(PrrtPacketTimeoutTable_insert(sock_ptr->packetTimeoutTable, packetTimeout), "Could not insert data packet.");
131

Andreas Schmidt's avatar
Andreas Schmidt committed
132
    prrtSequenceNumber_t seqno = packet->sequenceNumber;
Andreas Schmidt's avatar
Andreas Schmidt committed
133
    PrrtReceptionTable_mark_received(sock_ptr->dataReceptionTable, seqno);
Stefan Reif's avatar
Stefan Reif committed
134

Andreas Schmidt's avatar
Andreas Schmidt committed
135 136 137 138
    prrtTimestamp_t now = PrrtClock_get_current_time_us();
    if (PrrtTimestamp_cmp(now, payload->packetTimeout_us) > 0) {
        debug(DEBUG_DATARECEIVER, "Timeout data packet %u (%lu > %lu)", seqno, (unsigned long) now,
              (unsigned long) payload->packetTimeout_us);
139
        PrrtDeliveredPacketTable_test_set_is_number_relevant(sock_ptr->deliveredPacketTable, packet->sequenceNumber);
140
        PrrtPacket_destroy(packet);
Andreas Schmidt's avatar
Andreas Schmidt committed
141 142
    } else if (!PrrtDeliveredPacketTable_test_set_is_number_relevant(sock_ptr->deliveredPacketTable,
                                                                    packet->sequenceNumber)) {
Andreas Schmidt's avatar
Andreas Schmidt committed
143
        debug(DEBUG_DATARECEIVER, "Not relevant: %u", seqno);
144 145
        PrrtPacket_destroy(packet);
    } else {
146
        PrrtChannelStateInformation_update_delivery_rate(sock_ptr->senderChannelStateInformation, payload->btl_datarate);
Andreas Schmidt's avatar
Andreas Schmidt committed
147
        sock_ptr->send_peer_btl_pace = payload->btl_pace;
148 149 150
        prrtSequenceNumber_t baseSequenceNumber = packet->sequenceNumber - packet->index;

        PrrtPacket *reference = PrrtPacket_copy(packet);
151 152 153 154
        
        // forward to application layer
        debug(DEBUG_DATARECEIVER, "Forward: %u", seqno);
        PrrtPacketDeliveryStore_insert(sock_ptr->packetDeliveryStore, packet);
155 156

        PrrtBlock *block = PrrtRepairBlockStore_get_block(sock_ptr->repairBlockStore, baseSequenceNumber);
Andreas Schmidt's avatar
Andreas Schmidt committed
157
        if (block != NULL) {
Andreas Schmidt's avatar
Andreas Schmidt committed
158 159 160 161 162
            if(PrrtBlock_insert_data_packet(block, reference)) {
                decode_block(sock_ptr, block);
            } else {
                PrrtPacket_destroy(reference);
            }
163
        } else {
Andreas Schmidt's avatar
Andreas Schmidt committed
164
            debug(DEBUG_DATARECEIVER, "Inserting data packet %d for later.", reference->sequenceNumber);
Andreas Schmidt's avatar
Andreas Schmidt committed
165
            if (PrrtDataStore_insert(sock_ptr->dataPacketStore, reference) == false) {
Andreas Schmidt's avatar
Andreas Schmidt committed
166
                debug(DEBUG_DATARECEIVER, "Failed to insert %d.", reference->sequenceNumber);
167
                PrrtPacket_destroy(reference);
Andreas Schmidt's avatar
Andreas Schmidt committed
168 169
            } else {
                debug(DEBUG_DATARECEIVER, "Inserted %d.", reference->sequenceNumber);
170 171 172
            }
        }

173
        XlapTimeStampClock(sock_ptr, ts_data_packet, seqno, PrrtReturnPackage);
Andreas Schmidt's avatar
Andreas Schmidt committed
174
        XlapTimeStampCycle(sock_ptr, ts_data_packet, seqno, PrrtReturnPackage);
175 176 177 178 179 180 181
    }
    return;

    error:
    PERROR("Handling data packet failed%s.", "");
}

Andreas Schmidt's avatar
Andreas Schmidt committed
182
static void handle_redundancy_packet(PrrtSocket *socket, PrrtPacket *packet) {
183 184 185 186
    PrrtPacketRedundancyPayload *payload = packet->payload;
    prrtTimestamp_t sentTimestamp = payload->timestamp;
    socket->lastSentTimestamp = sentTimestamp;

187 188
    PrrtPacketRedundancyPayload *redundancyPayload = packet->payload;

Andreas Schmidt's avatar
Andreas Schmidt committed
189 190
    PrrtReceptionTable_mark_received(socket->redundancyReceptionTable, packet->sequenceNumber);

191 192 193
    if (!PrrtDeliveredPacketTable_test_is_block_relevant(socket->deliveredPacketTable,
                                                         redundancyPayload->baseSequenceNumber,
                                                         redundancyPayload->n)) {
194 195 196 197
        PrrtPacket_destroy(packet);
    } else {
        PrrtBlock *block = PrrtRepairBlockStore_get_block(socket->repairBlockStore,
                                                          redundancyPayload->baseSequenceNumber);
Andreas Schmidt's avatar
Andreas Schmidt committed
198
        socket->send_peer_btl_pace = payload->btl_pace;
Andreas Schmidt's avatar
Andreas Schmidt committed
199
        if (block == NULL) {
200
            uint8_t n_cycle[1] = {redundancyPayload->n - redundancyPayload->k};
Andreas Schmidt's avatar
Andreas Schmidt committed
201
            PrrtCodingConfiguration *codingParams = PrrtCodingConfiguration_create(redundancyPayload->k,
202
                                                                                   redundancyPayload->n, 1, n_cycle);
203

Andreas Schmidt's avatar
Andreas Schmidt committed
204 205
            block = PrrtBlock_create(codingParams, PrrtSocket_get_matching_coder(socket, codingParams),
                                     redundancyPayload->baseSequenceNumber);
206

207
            PrrtRepairBlockStore_insert(socket->repairBlockStore, block);
208

Andreas Schmidt's avatar
Andreas Schmidt committed
209 210
            retrieve_data_packets_for_block(socket, redundancyPayload->baseSequenceNumber, block->codingParams->k, block);
        }
211

Andreas Schmidt's avatar
Andreas Schmidt committed
212
        if (PrrtBlock_insert_redundancy_packet(block, packet)) {
213 214 215 216 217 218 219
            decode_block(socket, block);
        } else {
            PrrtPacket_destroy(packet);
        }
    }
}

Andreas Schmidt's avatar
Andreas Schmidt committed
220 221
void handle_feedback_packet(PrrtSocket *socket, PrrtPacket *packet, prrtTimestamp_t receiveTime) {
    check(packet != NULL, "Cannot be null");
222
    debug(DEBUG_DATARECEIVER, "handle_feedback_packet");
Andreas Schmidt's avatar
Andreas Schmidt committed
223
    PrrtPacketFeedbackPayload *feedbackPayload = (PrrtPacketFeedbackPayload *) packet->payload;
224 225
    prrtTimestamp_t forwardTripTimestamp = feedbackPayload->forwardTripTimestamp_us;

226
    prrtTimedelta_t rtt = (prrtTimedelta_t) (receiveTime - forwardTripTimestamp);
227
    socket->recv_peer_btl_pace = feedbackPayload->btl_pace;
228

Andreas Schmidt's avatar
Andreas Schmidt committed
229
    PrrtReceiver_on_ack(socket->receiver, feedbackPayload, receiveTime, rtt, socket->applicationConstraints);
230 231 232 233 234 235
    return;

    error:
    PERROR("handle_feedback_packet failed.");
}

236
void receive_from_socket(PrrtSocket *socket_ptr, unsigned char buffer_ptr[65528], ssize_t *received_size,
Andreas Schmidt's avatar
Andreas Schmidt committed
237 238
                         struct sockaddr_in *remote_ptr, socklen_t *remote_len_ptr,
                         struct timespec *packet_timestamp_ptr,
239
                         uint64_t *packet_cyclestamp_ptr) {
Andreas Schmidt's avatar
Andreas Schmidt committed
240
    if (socket_ptr->isHardwareTimestamping) {
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
        struct cmsghdr *cmsg;
        struct msghdr msg;
        struct iovec entry;

        struct {
            struct cmsghdr cm;
            char control[512];
        } control;

        memset(&msg, 0, sizeof(msg));
        msg.msg_iov = &entry;
        msg.msg_iovlen = 1;
        entry.iov_base = buffer_ptr;
        entry.iov_len = MAX_PAYLOAD_LENGTH;
        msg.msg_name = (caddr_t) remote_ptr;
        msg.msg_namelen = *remote_len_ptr;
        msg.msg_control = &control;
        msg.msg_controllen = sizeof(control);

260
        *received_size = recvmsg(socket_ptr->socketFd, &msg, 0);
261

Andreas Schmidt's avatar
Andreas Schmidt committed
262 263
        for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
            switch (cmsg->cmsg_type) {
264
                case SO_TIMESTAMPNS: {
265
                    memcpy(packet_timestamp_ptr, (struct timespec *) CMSG_DATA(cmsg), sizeof(struct timespec));
266 267 268 269 270 271 272 273
                    break;
                }
                default:
                    PERROR("Unknown Control Msg Type: %d", cmsg->cmsg_type);
                    break;
            }
        }
    } else {
274
        *received_size = recvfrom(socket_ptr->socketFd, buffer_ptr, MAX_PAYLOAD_LENGTH, 0,
275
                                  (struct sockaddr *) remote_ptr, remote_len_ptr);
276
        clock_gettime(CLOCK_REALTIME, packet_timestamp_ptr);
277
    }
278
    *packet_cyclestamp_ptr = __builtin_ia32_rdtsc();
279 280
}

Andreas Schmidt's avatar
Andreas Schmidt committed
281
void *receive_data_loop(void *ptr) {
282 283 284 285
    ssize_t n;
    struct sockaddr_in remote;
    socklen_t addrlen = sizeof(remote);
    unsigned char buffer[MAX_PAYLOAD_LENGTH];
286
    PrrtSocket *s = ptr;
287

Andreas Schmidt's avatar
Andreas Schmidt committed
288
    while (1) {
Andreas Schmidt's avatar
Andreas Schmidt committed
289
        PrrtPace_track_start(s->prrtReceivePace);
290
        debug(DEBUG_DATARECEIVER, "About to receive.");
Andreas Schmidt's avatar
Andreas Schmidt committed
291 292 293 294 295 296
        XlapTimestampPlaceholder tsph1;
        XlapTimestampPlaceholder tsph2;
        XlapTimestampPlaceholder tsph3;
        XlapTimestampPlaceholderInitialize(&tsph1);
        XlapTimestampPlaceholderInitialize(&tsph2);
        XlapTimestampPlaceholderInitialize(&tsph3);
Stefan Reif's avatar
Stefan Reif committed
297

298 299
        struct timespec packet_recv_timestamp;
        uint64_t packet_recv_cyclestamp = 0;
Andreas Schmidt's avatar
Andreas Schmidt committed
300 301
        PrrtPace_track_pause(s->prrtReceivePace);
        receive_from_socket(s, buffer, &n, &remote, &addrlen, &packet_recv_timestamp, &packet_recv_cyclestamp);
Andreas Schmidt's avatar
Andreas Schmidt committed
302
        pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
Andreas Schmidt's avatar
Andreas Schmidt committed
303
        PrrtPace_track_resume(s->prrtReceivePace);
Andreas Schmidt's avatar
Andreas Schmidt committed
304
        if (atomic_load_explicit(&s->closing, memory_order_acquire)) {
305 306 307
            break;
        }

308 309
        debug(DEBUG_HARDSTAMPING, "Packet TS:\t%ld.%09ld; Who? %s", (long) packet_recv_timestamp.tv_sec,
              packet_recv_timestamp.tv_nsec, inet_ntoa(remote.sin_addr));
Andreas Schmidt's avatar
Andreas Schmidt committed
310 311
        XlapTimeStampClock(&tsph1, ts_any_packet, 0, LinkReceive);
        XlapTimeStampCycle(&tsph1, ts_any_packet, 0, LinkReceive);
312

313
        PrrtPacket *packet = (PrrtPacket *) calloc(1, sizeof(PrrtPacket));
314
        check_mem(packet);
Andreas Schmidt's avatar
Andreas Schmidt committed
315
        XlapTimeStampCycle(&tsph2, ts_any_packet, 0, DecodeStart);
316
        check(PrrtPacket_decode(buffer, (uint16_t) n, packet), "Decode failed.");
Andreas Schmidt's avatar
Andreas Schmidt committed
317 318
        XlapTimeStampCycle(&tsph3, ts_any_packet, 0, DecodeEnd);
        prrtSequenceNumber_t seqno = packet->sequenceNumber;
319
        prrtTimestamp_t prrt_recv_timestamp = PrrtClock_TimespecToPrrtTimestamp(packet_recv_timestamp);
320
        memcpy(&packet->sender_addr, &remote, addrlen);
321

322
        prrtPacketType_t packetType = PrrtPacket_type(packet);
Andreas Schmidt's avatar
Andreas Schmidt committed
323
        debug(DEBUG_DATARECEIVER, "received packet %d:%u", (int) packetType, seqno);
324
        packet->channelReceive = packet_recv_timestamp;
325

Andreas Schmidt's avatar
Andreas Schmidt committed
326
        enum XlapTimestampPacketKind kind = ts_any_packet;
327
        prrtTimestamp_t sentTimestamp;
Andreas Schmidt's avatar
Andreas Schmidt committed
328
        if (packetType == PACKET_TYPE_DATA) {
Andreas Schmidt's avatar
Andreas Schmidt committed
329
            kind = ts_data_packet;
330
            sentTimestamp = PrrtPacket_get_data_timestamp(packet);
Andreas Schmidt's avatar
Andreas Schmidt committed
331
        } else if (packetType == PACKET_TYPE_REDUNDANCY) {
Andreas Schmidt's avatar
Andreas Schmidt committed
332
            kind = ts_redundancy_packet;
333
            sentTimestamp = PrrtPacket_get_redundancy_timestamp(packet);
334 335
        } else if (packetType == PACKET_TYPE_FEEDBACK) {
            kind = ts_feedback_packet;
Andreas Schmidt's avatar
Andreas Schmidt committed
336 337
        }
        if (packetType == PACKET_TYPE_DATA || packetType == PACKET_TYPE_REDUNDANCY) {
338
            s->lastReceivedTimestamp = prrt_recv_timestamp;
339

340 341
            XlapCycleStampValue(s, kind, seqno, ChannelReceive, packet_recv_cyclestamp);
            XlapTimeStampValue(s, kind, seqno, ChannelReceive, packet_recv_timestamp);
Andreas Schmidt's avatar
Andreas Schmidt committed
342

343 344 345
            XlapTimestampPlaceholderUse(s, kind, seqno, &tsph1);
            XlapTimestampPlaceholderUse(s, kind, seqno, &tsph2);
            XlapTimestampPlaceholderUse(s, kind, seqno, &tsph3);
Andreas Schmidt's avatar
Andreas Schmidt committed
346

347
            XlapTimeStampCycle(s, kind, seqno, HandlePacketStart);
348

Andreas Schmidt's avatar
Andreas Schmidt committed
349
            if (packetType == PACKET_TYPE_DATA) {
350
                handle_data_packet(s, packet);
Andreas Schmidt's avatar
Andreas Schmidt committed
351
            } else {
Andreas Schmidt's avatar
Andreas Schmidt committed
352
                handle_redundancy_packet(s, packet);
Andreas Schmidt's avatar
Andreas Schmidt committed
353
            }
354 355
            send_feedback(s, remote, seqno, prrt_recv_timestamp, sentTimestamp, packetType);
            XlapTimeStampCycle(s, kind, seqno, HandlePacketEnd);
356
        } else if (packetType == PACKET_TYPE_FEEDBACK) {
357
            handle_feedback_packet(s, packet, prrt_recv_timestamp);
358
            PrrtPacket_destroy(packet);
Andreas Schmidt's avatar
Andreas Schmidt committed
359 360 361
        } else {
            PrrtPacket_print(packet);
            PrrtPacket_destroy(packet);
362
        }
363

364
        debug(DEBUG_DATARECEIVER, "Cleanup");
365
        PrrtSocket_cleanup(s);
366
        debug(DEBUG_DATARECEIVER, "Cleaned");
Andreas Schmidt's avatar
Andreas Schmidt committed
367
        PrrtPace_track_end(s->prrtReceivePace);
Andreas Schmidt's avatar
Andreas Schmidt committed
368
        pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
369 370 371
    }

    error:
Andreas Schmidt's avatar
Andreas Schmidt committed
372
    PERROR("receive_data_loop() ended unexpectedly.");
373
    PrrtSocket_cleanup(s);
374
    return NULL;
Andreas Schmidt's avatar
Andreas Schmidt committed
375
}