modified for termination when used for mictcp video replay
This commit is contained in:
parent
769f757fec
commit
dc7fb0af27
1 changed files with 9 additions and 5 deletions
|
@ -241,9 +241,10 @@ void file_to_mictcp(struct sockaddr_in listen_on, struct sockaddr_in transmit_to
|
||||||
struct timespec currentTime;
|
struct timespec currentTime;
|
||||||
struct timespec rem;
|
struct timespec rem;
|
||||||
int firstValue = 0;
|
int firstValue = 0;
|
||||||
|
int active = 1;
|
||||||
|
|
||||||
// Main activity loop, we never exit this, user terminates with SIGKILL
|
// Main activity loop, we exit this at the end of the file
|
||||||
while(1) {
|
while(active) {
|
||||||
bzero(buffer, MAX_UDP_SEGMENT_SIZE);
|
bzero(buffer, MAX_UDP_SEGMENT_SIZE);
|
||||||
|
|
||||||
n = fread(¤tTimeFile, 1, sizeof(struct timespec), fd);
|
n = fread(¤tTimeFile, 1, sizeof(struct timespec), fd);
|
||||||
|
@ -266,9 +267,12 @@ void file_to_mictcp(struct sockaddr_in listen_on, struct sockaddr_in transmit_to
|
||||||
lastTimeFile = currentTimeFile;
|
lastTimeFile = currentTimeFile;
|
||||||
n = fread(buffer, 1, sizeof(n), fd);
|
n = fread(buffer, 1, sizeof(n), fd);
|
||||||
n = fread(buffer, 1, *((int *)buffer), fd);
|
n = fread(buffer, 1, *((int *)buffer), fd);
|
||||||
|
if (n <= 0) {
|
||||||
if(n < 0) {
|
if(n < 0) {
|
||||||
perror(0);
|
perror(0);
|
||||||
}
|
}
|
||||||
|
active = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// We forward the packet to its final destination
|
// We forward the packet to its final destination
|
||||||
n = mic_tcp_send(mic_tcp_sockfd, buffer, n);
|
n = mic_tcp_send(mic_tcp_sockfd, buffer, n);
|
||||||
|
@ -277,7 +281,7 @@ void file_to_mictcp(struct sockaddr_in listen_on, struct sockaddr_in transmit_to
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We never execute this but anyway, for sanity
|
// We execute this when the file has finished being replayed
|
||||||
close(listen_sockfd);
|
close(listen_sockfd);
|
||||||
|
|
||||||
// Same for MICTCP
|
// Same for MICTCP
|
||||||
|
|
Loading…
Reference in a new issue