@@ -79,21 +79,21 @@ fn gather_packets(
79
79
let v = std:: mem:: replace ( & mut iface. existing , vec ! [ ] ) ;
80
80
to_sort. extend ( v) ;
81
81
}
82
- println ! ( "Have {} existing packets" , to_sort. len( ) ) ;
82
+ trace ! ( "Have {} existing packets" , to_sort. len( ) ) ;
83
83
if let Some ( ts) = gather_to {
84
84
for iface in interfaces. iter_mut ( ) {
85
85
let current = std:: mem:: replace ( & mut iface. current , vec ! [ ] ) ;
86
86
let t: ( Vec < _ > , Vec < _ > ) = current. into_iter ( ) . partition ( |p| {
87
87
* p. timestamp ( ) < ts
88
88
} ) ;
89
89
let ( before_ts, after_ts) = t;
90
- println ! ( "Adding {} packets based on timestamp, {} packets adding to existing" , before_ts. len( ) , after_ts. len( ) ) ;
90
+ trace ! ( "Adding {} packets based on timestamp, {} packets adding to existing" , before_ts. len( ) , after_ts. len( ) ) ;
91
91
to_sort. extend ( before_ts) ;
92
92
iface. existing = after_ts;
93
93
}
94
94
} else {
95
95
for iface in interfaces. iter_mut ( ) {
96
- println ! ( "Moving {} packets into existing" , iface. current. len( ) ) ;
96
+ trace ! ( "Moving {} packets into existing" , iface. current. len( ) ) ;
97
97
std:: mem:: swap ( & mut iface. existing , & mut iface. current ) ;
98
98
}
99
99
}
@@ -106,7 +106,7 @@ impl Stream for BridgeStream {
106
106
107
107
fn poll_next ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Option < Self :: Item > > {
108
108
let this = self . project ( ) ;
109
- debug ! ( "Interfaces: {:?}" , this. interfaces. len( ) ) ;
109
+ trace ! ( "Interfaces: {:?}" , this. interfaces. len( ) ) ;
110
110
let interfaces: & mut VecDeque < BridgedInterface > = this. interfaces ;
111
111
let config: & mut Config = this. config ; //TODO use the Self {} extractor
112
112
@@ -119,7 +119,7 @@ impl Stream for BridgeStream {
119
119
}
120
120
if let Some ( mut existing_delay) = iface. delaying . take ( ) { //Check the interface for a delay..
121
121
if let Poll :: Pending = Pin :: new ( & mut existing_delay) . poll ( cx) { //still delayed?
122
- debug ! ( "Delaying" ) ;
122
+ trace ! ( "Delaying" ) ;
123
123
iface. delaying = Some ( existing_delay) ;
124
124
continue ; // do another iteration on another iface
125
125
}
@@ -128,7 +128,7 @@ impl Stream for BridgeStream {
128
128
let mut existing_future = iface. pending . take ( ) . unwrap_or_else ( || PacketFuture :: new ( config, & iface. handle ) ) ;
129
129
match Pin :: new ( & mut existing_future) . poll ( cx) {
130
130
Poll :: Pending => {
131
- println ! ( "Pending" ) ;
131
+ trace ! ( "Pending" ) ;
132
132
iface. pending = Some ( existing_future) ;
133
133
continue ;
134
134
//return Poll::Pending;
@@ -137,7 +137,7 @@ impl Stream for BridgeStream {
137
137
return Poll :: Ready ( Some ( Err ( e) ) ) ;
138
138
}
139
139
Poll :: Ready ( Ok ( None ) ) => {
140
- println ! ( "Interface has completed" ) ;
140
+ trace ! ( "Interface has completed" ) ;
141
141
iface. complete = true ;
142
142
continue ;
143
143
}
@@ -151,21 +151,20 @@ impl Stream for BridgeStream {
151
151
std:: cmp:: min ( ts, * p. timestamp ( ) )
152
152
} ) . or ( Some ( * p. timestamp ( ) ) ) ;
153
153
}
154
- println ! ( "Adding {} packets to current" , v. len( ) ) ;
154
+ trace ! ( "Adding {} packets to current" , v. len( ) ) ;
155
155
iface. current . extend ( v) ;
156
156
}
157
157
}
158
158
}
159
159
160
- println ! ( "EOL {:?}" , interfaces. len( ) ) ;
161
160
162
161
let res = gather_packets ( interfaces, gather_to) ;
163
162
164
163
interfaces. retain ( |iface| { //drop the complete interfaces
165
164
return !iface. complete ;
166
165
} ) ;
167
166
168
- if res. is_empty ( ) {
167
+ if res. is_empty ( ) && interfaces . is_empty ( ) {
169
168
return Poll :: Ready ( None ) ;
170
169
} else {
171
170
return Poll :: Ready ( Some ( Ok ( res) ) ) ;
0 commit comments