X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fsflow_sampler.c;h=280d54df7fdc387ac79be6b8ed74419e7296765f;hb=a5ac7299f8042c01fcdb60c5508047146baf3a16;hp=759b5a22c7e95f53467ccd729125c4e6ca5f8d38;hpb=c72e245a0e2c979f4c14279b56183e2200905c6c;p=openvswitch diff --git a/lib/sflow_sampler.c b/lib/sflow_sampler.c index 759b5a22..280d54df 100644 --- a/lib/sflow_sampler.c +++ b/lib/sflow_sampler.c @@ -16,19 +16,22 @@ void sfl_sampler_init(SFLSampler *sampler, SFLAgent *agent, SFLDataSource_instan SFLDataSource_instance dsi = *pdsi; /* preserve the *nxt pointer too, in case we are resetting this poller and it is - already part of the agent's linked list (thanks to Matt Woodly for pointing this out) */ + already part of the agent's linked list (thanks to Matt Woodly for pointing this out, + and to Andy Kitchingman for pointing out that it applies to the hash_nxt ptr too) */ SFLSampler *nxtPtr = sampler->nxt; - + SFLSampler *hashPtr = sampler->hash_nxt; + /* clear everything */ memset(sampler, 0, sizeof(*sampler)); - - /* restore the linked list ptr */ + + /* restore the linked list and hash-table ptr */ sampler->nxt = nxtPtr; - + sampler->hash_nxt = hashPtr; + /* now copy in the parameters */ sampler->agent = agent; sampler->dsi = dsi; - + /* set defaults */ sampler->sFlowFsMaximumHeaderSize = SFL_DEFAULT_HEADER_SIZE; sampler->sFlowFsPacketSamplingRate = SFL_DEFAULT_SAMPLING_RATE; @@ -154,7 +157,7 @@ inline static u_int32_t nextRandomSkip(u_int32_t mean) { if(mean == 0 || mean == 1) return 1; return ((random() % ((2 * mean) - 1)) + 1); -} +} /*_________________---------------------------__________________ _________________ sfl_sampler_takeSample __________________