Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LARN
PRRT
Commits
122166aa
Commit
122166aa
authored
Mar 09, 2016
by
Andreas Schmidt
Browse files
Data packets are now send right away.
parent
e6a10895
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/prrt/processes/data_transmitter.c
View file @
122166aa
...
...
@@ -34,6 +34,7 @@ bool send_packet(PrrtSocket *sock_ptr, PrrtPacket *packet) {
memcpy
((
void
*
)
&
targetaddr
.
sin_addr
,
hp
->
h_addr_list
[
0
],
(
size_t
)
hp
->
h_length
);
ssize_t
sendtoRes
=
sendto
(
sock_ptr
->
dataSocketFd
,
buf
,
length
,
0
,
(
struct
sockaddr
*
)
&
targetaddr
,
sizeof
(
targetaddr
));
usleep
(
1
);
check
(
sendtoRes
>=
0
,
"Sendto failed."
)
}
...
...
@@ -79,10 +80,15 @@ void * send_data_loop(void *ptr) {
PrrtPacket
*
packet
=
List_shift
(
sock_ptr
->
outQueue
);
packet
->
seqno
=
sock_ptr
->
sequenceNumberSource
++
;
packet
->
index
=
(
uint8_t
)
(
packet
->
seqno
-
block
->
baseSequenceNumber
);
PrrtPacket
*
packetToSend
=
PrrtPacket_copy
(
packet
);
send_packet
(
sock_ptr
,
packetToSend
);
PrrtBlock_insert_data_packet
(
block
,
packet
);
if
(
PrrtBlock_encode_ready
(
block
))
{
// TODO: redundancy should only be sent when necessary
if
(
PrrtBlock_encode_ready
(
block
)
&&
false
)
{
uint32_t
j
=
0
;
PrrtBlock_encode
(
block
,
&
sock_ptr
->
sequenceNumberRedundancy
);
...
...
@@ -92,18 +98,11 @@ void * send_data_loop(void *ptr) {
send_packet
(
sock_ptr
,
red_pkt
);
}
uint32_t
dataBlocks
=
List_count
(
block
->
dataPackets
);
for
(
j
=
0
;
j
<
dataBlocks
;
j
++
)
{
PrrtPacket
*
data_pkt
=
PrrtBlock_get_first_data
(
block
);
send_packet
(
sock_ptr
,
data_pkt
);
}
PrrtBlock_destroy
(
block
);
block
=
NULL
;
}
pthread_mutex_unlock
(
&
sock_ptr
->
outQueueFilledMutex
);
usleep
(
1
);
}
error:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment