Commit eacd1cfb authored by Robert Schmidt's avatar Robert Schmidt

PROTO_AGENT test program changes

parent b564b116
...@@ -35,12 +35,19 @@ pdcp_data_ind( ...@@ -35,12 +35,19 @@ pdcp_data_ind(
) )
{ {
fwrite(sdu_buffer_pP->data, sdu_buffer_sizeP, 1, stdout); fwrite(sdu_buffer_pP->data, sdu_buffer_sizeP, 1, stdout);
free_mem_block(sdu_buffer_pP, __func__);
fflush(stdout); fflush(stdout);
free_mem_block(sdu_buffer_pP, __func__);
/* cannot free because of const */
free(ctxt_pP);
recv_client = 1; recv_client = 1;
return 0; return 0;
} }
void close_proto_agent(void)
{
proto_agent_stop(0);
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
const cudu_params_t params = { const cudu_params_t params = {
...@@ -79,6 +86,7 @@ int main(int argc, char *argv[]) ...@@ -79,6 +86,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "error on proto_agent_start()\n"); fprintf(stderr, "error on proto_agent_start()\n");
return 3; return 3;
} }
atexit(close_proto_agent);
/* wait for first packet of client */ /* wait for first packet of client */
while (!recv_client) sleep(1); while (!recv_client) sleep(1);
...@@ -87,7 +95,7 @@ int main(int argc, char *argv[]) ...@@ -87,7 +95,7 @@ int main(int argc, char *argv[])
/* now send back at the same time */ /* now send back at the same time */
gettimeofday(&t_start, NULL); gettimeofday(&t_start, NULL);
while ((size = fread(s, 1, BUF_MAX, f)) > 0) { while ((size = fread(s, 1, BUF_MAX, f)) > 0) {
usleep(100); usleep(10);
totsize += size; totsize += size;
mem.data = &s[0]; mem.data = &s[0];
proto_agent_send_rlc_data_req(&p, 0, 0, 0, 0, 0, size, &mem); proto_agent_send_rlc_data_req(&p, 0, 0, 0, 0, 0, size, &mem);
...@@ -101,7 +109,7 @@ int main(int argc, char *argv[]) ...@@ -101,7 +109,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "check files using 'diff afile bfile'\n"); fprintf(stderr, "check files using 'diff afile bfile'\n");
/* give some time in case the other direction is slower */ /* give some time in case the other direction is slower */
sleep(60); sleep(5);
return 0; return 0;
} }
......
...@@ -38,11 +38,17 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, ...@@ -38,11 +38,17 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
) )
{ {
fwrite(sdu_pP->data, sdu_sizeP, 1, stdout); fwrite(sdu_pP->data, sdu_sizeP, 1, stdout);
free_mem_block(sdu_pP, __func__);
fflush(stdout); fflush(stdout);
free_mem_block(sdu_pP, __func__);
free(ctxt_pP);
return 0; return 0;
} }
void close_proto_agent(void)
{
proto_agent_stop(0);
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
const cudu_params_t params = { const cudu_params_t params = {
...@@ -81,10 +87,11 @@ int main(int argc, char *argv[]) ...@@ -81,10 +87,11 @@ int main(int argc, char *argv[])
fprintf(stderr, "error on proto_agent_start()\n"); fprintf(stderr, "error on proto_agent_start()\n");
return 3; return 3;
} }
atexit(close_proto_agent);
gettimeofday(&t_start, NULL); gettimeofday(&t_start, NULL);
while ((size = fread(s, 1, BUF_MAX, f)) > 0) { while ((size = fread(s, 1, BUF_MAX, f)) > 0) {
usleep(100); usleep(10);
totsize += size; totsize += size;
mem.data = &s[0]; mem.data = &s[0];
proto_agent_send_pdcp_data_ind(&p, 0, 0, 0, size, &mem); proto_agent_send_pdcp_data_ind(&p, 0, 0, 0, size, &mem);
...@@ -98,7 +105,7 @@ int main(int argc, char *argv[]) ...@@ -98,7 +105,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "check files using 'diff afile bfile'\n"); fprintf(stderr, "check files using 'diff afile bfile'\n");
/* wait, we are possibly receiving data */ /* wait, we are possibly receiving data */
sleep(60); sleep(5);
return 0; return 0;
} }
......
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