MCPcopy
hub / github.com/tsenart/vegeta / processAttack

Function processAttack

attack.go:235–263  ·  view source on GitHub ↗
(
	atk *vegeta.Attacker,
	res <-chan *vegeta.Result,
	enc vegeta.Encoder,
	sig <-chan os.Signal,
	pm *prom.Metrics,
)

Source from the content-addressed store, hash-verified

233}
234
235func processAttack(
236 atk *vegeta.Attacker,
237 res <-chan *vegeta.Result,
238 enc vegeta.Encoder,
239 sig <-chan os.Signal,
240 pm *prom.Metrics,
241) error {
242 for {
243 select {
244 case <-sig:
245 if stopSent := atk.Stop(); !stopSent {
246 // Exit immediately on second signal.
247 return nil
248 }
249 case r, ok := <-res:
250 if !ok {
251 return nil
252 }
253
254 if pm != nil {
255 pm.Observe(r)
256 }
257
258 if err := enc.Encode(r); err != nil {
259 return err
260 }
261 }
262 }
263}
264
265// tlsConfig builds a *tls.Config from the given options.
266func tlsConfig(insecure bool, certf, keyf string, rootCerts []string) (*tls.Config, error) {

Callers 3

TestAttackSignalOnceFunction · 0.85
TestAttackSignalTwiceFunction · 0.85
attackFunction · 0.85

Calls 3

StopMethod · 0.80
ObserveMethod · 0.80
EncodeMethod · 0.45

Tested by 2

TestAttackSignalOnceFunction · 0.68
TestAttackSignalTwiceFunction · 0.68