@@ -322,6 +322,46 @@ static const struct vdp xyzzy_vdp_pedantic = {
322
322
.fini = xyzzy_pedantic_fini ,
323
323
};
324
324
325
+ /**********************************************************************
326
+ *
327
+ * this trivial copy/paste/edit filter (of rot13) was specifically made for
328
+ * someone who added a DBG_SLOW_BEREQ debug flag. It should actually be turned
329
+ * in a proper "bandwidth control" filter, but that exceeds an evening's work,
330
+ * so it's kept for later
331
+ */
332
+
333
+ static enum vfp_status v_matchproto_ (vfp_pull_f )
334
+ xyzzy_vfp_slow_pull (struct vfp_ctx * vc , struct vfp_entry * vfe , void * p ,
335
+ ssize_t * lp )
336
+ {
337
+
338
+ (void )vfe ;
339
+ VTIM_sleep (1.0 );
340
+ return (VFP_Suck (vc , p , lp ));
341
+ }
342
+
343
+ static const struct vfp xyzzy_vfp_slow = {
344
+ .name = "debug.slow" ,
345
+ .pull = xyzzy_vfp_slow_pull ,
346
+ };
347
+
348
+ /**********************************************************************/
349
+
350
+ static int v_matchproto_ (vdp_bytes_f )
351
+ xyzzy_vdp_slow_bytes (struct vdp_ctx * vdc , enum vdp_action act , void * * priv ,
352
+ const void * ptr , ssize_t len )
353
+ {
354
+
355
+ (void )priv ;
356
+ VTIM_sleep (1.0 );
357
+ return (VDP_bytes (vdc , act , ptr , len ));
358
+ }
359
+
360
+ static const struct vdp xyzzy_vdp_slow = {
361
+ .name = "debug.slow" ,
362
+ .bytes = xyzzy_vdp_slow_bytes
363
+ };
364
+
325
365
/**********************************************************************/
326
366
327
367
VCL_STRING v_matchproto_ (td_debug_author )
@@ -593,6 +633,7 @@ event_load(VRT_CTX, struct vmod_priv *priv)
593
633
AZ (VRT_AddFilter (ctx , & xyzzy_vfp_rot13 , & xyzzy_vdp_rot13 ));
594
634
AZ (VRT_AddFilter (ctx , NULL , & xyzzy_vdp_pedantic ));
595
635
AZ (VRT_AddFilter (ctx , NULL , & xyzzy_vdp_chunked ));
636
+ AZ (VRT_AddFilter (ctx , & xyzzy_vfp_slow , & xyzzy_vdp_slow ));
596
637
return (0 );
597
638
}
598
639
@@ -754,6 +795,7 @@ event_discard(VRT_CTX, void *priv)
754
795
755
796
AZ (ctx -> msg );
756
797
798
+ VRT_RemoveFilter (ctx , & xyzzy_vfp_slow , & xyzzy_vdp_slow );
757
799
VRT_RemoveFilter (ctx , & xyzzy_vfp_rot13 , & xyzzy_vdp_rot13 );
758
800
VRT_RemoveFilter (ctx , NULL , & xyzzy_vdp_pedantic );
759
801
VRT_RemoveFilter (ctx , NULL , & xyzzy_vdp_chunked );
0 commit comments