diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
commit | 5746309cb4be2073d550ad7a6885e918631dbc38 (patch) | |
tree | 89455bc4aadf977816b38df13f990372cd81d71a /src/fragmentation/defragmentation.c | |
parent | 6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff) | |
download | gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip |
indentation
Diffstat (limited to 'src/fragmentation/defragmentation.c')
-rw-r--r-- | src/fragmentation/defragmentation.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/fragmentation/defragmentation.c b/src/fragmentation/defragmentation.c index 35d59854f..bd4dfba5a 100644 --- a/src/fragmentation/defragmentation.c +++ b/src/fragmentation/defragmentation.c | |||
@@ -203,8 +203,7 @@ struct GNUNET_DEFRAGMENT_Context | |||
203 | */ | 203 | */ |
204 | struct GNUNET_DEFRAGMENT_Context * | 204 | struct GNUNET_DEFRAGMENT_Context * |
205 | GNUNET_DEFRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats, | 205 | GNUNET_DEFRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats, |
206 | uint16_t mtu, | 206 | uint16_t mtu, unsigned int num_msgs, |
207 | unsigned int num_msgs, | ||
208 | void *cls, | 207 | void *cls, |
209 | GNUNET_FRAGMENT_MessageProcessor proc, | 208 | GNUNET_FRAGMENT_MessageProcessor proc, |
210 | GNUNET_DEFRAGMENT_AckProcessor ackp) | 209 | GNUNET_DEFRAGMENT_AckProcessor ackp) |
@@ -268,8 +267,8 @@ send_ack (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
268 | fa.fragment_id = htonl (mc->fragment_id); | 267 | fa.fragment_id = htonl (mc->fragment_id); |
269 | fa.bits = GNUNET_htonll (mc->bits); | 268 | fa.bits = GNUNET_htonll (mc->bits); |
270 | GNUNET_STATISTICS_update (mc->dc->stats, | 269 | GNUNET_STATISTICS_update (mc->dc->stats, |
271 | _("# acknowledgements sent for fragment"), | 270 | _("# acknowledgements sent for fragment"), 1, |
272 | 1, GNUNET_NO); | 271 | GNUNET_NO); |
273 | dc->ackp (dc->cls, mc->fragment_id, &fa.header); | 272 | dc->ackp (dc->cls, mc->fragment_id, &fa.header); |
274 | } | 273 | } |
275 | 274 | ||
@@ -279,9 +278,9 @@ send_ack (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
279 | * (C) 2000 Brian Gough | 278 | * (C) 2000 Brian Gough |
280 | */ | 279 | */ |
281 | static void | 280 | static void |
282 | gsl_fit_mul (const double *x, const size_t xstride, | 281 | gsl_fit_mul (const double *x, const size_t xstride, const double *y, |
283 | const double *y, const size_t ystride, | 282 | const size_t ystride, const size_t n, double *c1, double *cov_11, |
284 | const size_t n, double *c1, double *cov_11, double *sumsq) | 283 | double *sumsq) |
285 | { | 284 | { |
286 | double m_x = 0, m_y = 0, m_dx2 = 0, m_dxdy = 0; | 285 | double m_x = 0, m_y = 0, m_dx2 = 0, m_dxdy = 0; |
287 | 286 | ||
@@ -457,8 +456,8 @@ GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc, | |||
457 | while ((NULL != mc) && (fid != mc->fragment_id)) | 456 | while ((NULL != mc) && (fid != mc->fragment_id)) |
458 | mc = mc->next; | 457 | mc = mc->next; |
459 | bit = foff / (dc->mtu - sizeof (struct FragmentHeader)); | 458 | bit = foff / (dc->mtu - sizeof (struct FragmentHeader)); |
460 | if (bit * (dc->mtu - sizeof (struct FragmentHeader)) + ntohs (msg->size) | 459 | if (bit * (dc->mtu - sizeof (struct FragmentHeader)) + ntohs (msg->size) - |
461 | - sizeof (struct FragmentHeader) > msize) | 460 | sizeof (struct FragmentHeader) > msize) |
462 | { | 461 | { |
463 | /* payload extends past total message size */ | 462 | /* payload extends past total message size */ |
464 | GNUNET_break_op (0); | 463 | GNUNET_break_op (0); |
@@ -497,8 +496,8 @@ GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc, | |||
497 | { | 496 | { |
498 | mc->bits -= 1LL << bit; | 497 | mc->bits -= 1LL << bit; |
499 | mbuf = (char *) &mc[1]; | 498 | mbuf = (char *) &mc[1]; |
500 | memcpy (&mbuf[bit * (dc->mtu - sizeof (struct FragmentHeader))], | 499 | memcpy (&mbuf[bit * (dc->mtu - sizeof (struct FragmentHeader))], &fh[1], |
501 | &fh[1], ntohs (msg->size) - sizeof (struct FragmentHeader)); | 500 | ntohs (msg->size) - sizeof (struct FragmentHeader)); |
502 | mc->last_update = now; | 501 | mc->last_update = now; |
503 | if (bit < mc->last_bit) | 502 | if (bit < mc->last_bit) |
504 | mc->frag_times_start_offset = mc->frag_times_write_offset; | 503 | mc->frag_times_start_offset = mc->frag_times_write_offset; |
@@ -511,9 +510,8 @@ GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc, | |||
511 | else | 510 | else |
512 | { | 511 | { |
513 | duplicate = GNUNET_YES; | 512 | duplicate = GNUNET_YES; |
514 | GNUNET_STATISTICS_update (dc->stats, | 513 | GNUNET_STATISTICS_update (dc->stats, _("# duplicate fragments received"), 1, |
515 | _("# duplicate fragments received"), | 514 | GNUNET_NO); |
516 | 1, GNUNET_NO); | ||
517 | } | 515 | } |
518 | 516 | ||
519 | /* count number of missing fragments */ | 517 | /* count number of missing fragments */ |
@@ -531,8 +529,8 @@ GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc, | |||
531 | mc->ack_task = GNUNET_SCHEDULER_add_delayed (delay, &send_ack, mc); | 529 | mc->ack_task = GNUNET_SCHEDULER_add_delayed (delay, &send_ack, mc); |
532 | if ((duplicate == GNUNET_NO) && (0 == mc->bits)) | 530 | if ((duplicate == GNUNET_NO) && (0 == mc->bits)) |
533 | { | 531 | { |
534 | GNUNET_STATISTICS_update (dc->stats, | 532 | GNUNET_STATISTICS_update (dc->stats, _("# messages defragmented"), 1, |
535 | _("# messages defragmented"), 1, GNUNET_NO); | 533 | GNUNET_NO); |
536 | /* message complete, notify! */ | 534 | /* message complete, notify! */ |
537 | dc->proc (dc->cls, mc->msg); | 535 | dc->proc (dc->cls, mc->msg); |
538 | } | 536 | } |