On Mon, Nov 16, 2015 at 09:23:49AM +0100, Tobias Klauser wrote:
> On 2015-11-12 at 07:54:19 +0100, Vadim Kochan <[email protected]> wrote:
> > Now it is possible toggle display TCP/UDP/DCCP/ICMP/SCTP protos
> > by the same char keys as short command line options - T/U/D/I/S.
> >
> > Signed-off-by: Vadim Kochan <[email protected]>
> > ---
> > flowtop.c | 69
> > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
> > 1 file changed, 65 insertions(+), 4 deletions(-)
> >
> > diff --git a/flowtop.c b/flowtop.c
> > index 4c6f383..b6d3a08 100644
> > --- a/flowtop.c
> > +++ b/flowtop.c
> > @@ -104,6 +104,14 @@ enum flow_direction {
> > #define INCLUDE_ICMP (1 << 5)
> > #define INCLUDE_SCTP (1 << 6)
> >
> > @@ -1274,6 +1311,18 @@ static void presenter(void)
> > wclear(screen);
> > clear();
> > break;
> > + case 'T':
> > + case 'U':
> > + case 'D':
> > + case 'I':
> > + case 'S':
> > + if (is_flow_collecting)
> > + break;
>
> In this case we will silently discard the user input, which is not very
> nice. Do you see any reasonable way to avoid that?
I will try how it will work w/o this condition ...
>
> > +
> > + show_option_toggle(ch);
> > +
> > + do_reload_flows = true;
> > + break;
> > default:
> > fflush(stdin);
> > redraw_flows = false;
> > @@ -1606,11 +1655,21 @@ static void *collector(void *null __maybe_unused)
> >
> > rcu_register_thread();
> >
> > +reload:
> > + if (do_reload_flows)
> > + collector_create_filter(ct_event);
> > +
> > + do_reload_flows = false;
> > collector_dump_flows();
> >
> > while (!sigint) {
> > int status;
> >
> > + if (do_reload_flows) {
> > + flow_list_destroy(&flow_list);
> > + goto reload;
>
> Ugh, I don't like jumping out of the loop here, even if it saves some
> code duplication. But in that case I'd rather opt for duplicating the 4
> LoC above.
I will try to re-work this ...
--
You received this message because you are subscribed to the Google Groups
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.