Skip to content

Commit c6a6605

Browse files
fix to symbol filter in capture playback
1 parent 2b37fb5 commit c6a6605

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pcapps/pyth_csv.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,21 @@ class csv_print
4949
attr_dict attr_;
5050
pub_key skey_;
5151
std::string sym_;
52+
bool do_sym_;
5253
bool has_sym_;
5354
};
5455

5556
csv_print::csv_print()
5657
: sym_id_( attr_id::add( "symbol" ) ),
58+
do_sym_( false ),
5759
has_sym_( false )
5860
{
5961
}
6062

6163
void csv_print::set_symbol( const std::string& sym )
6264
{
6365
sym_ = sym;
66+
do_sym_ = !sym_.empty();
6467
}
6568

6669
void csv_print::print_header()
@@ -103,7 +106,7 @@ void csv_print::parse_product( replay& rep )
103106
smap_.ref( i ) = sym.as_string();
104107

105108
// check if symbol matches filter
106-
if ( sym_ == sym.as_string() ) {
109+
if ( do_sym_ && sym_ == sym.as_string() ) {
107110
has_sym_ = true;
108111
skey_ = *aptr;
109112
}
@@ -114,7 +117,7 @@ void csv_print::parse_price( replay& rep )
114117
pc_price_t *ptr = (pc_price_t*)rep.get_update();
115118
pub_key *aptr = (pub_key*)&ptr->prod_;
116119
// filter by symbol
117-
if ( has_sym_ && *aptr != skey_ ) {
120+
if ( do_sym_ && (!has_sym_ || *aptr != skey_ ) ) {
118121
return;
119122
}
120123
char tbuf[32];

0 commit comments

Comments
 (0)