services/syncbase: fix --race errors.

Fix race conditions detected by Syncbase --race testing:
* Add a mutex for a random number generator that uses a NewSource().
* Goroutines spawned in a loop must get a copy of the loop iterator,
  not access it through closure.

Change-Id: I88094fceac6708be2a3fbb49d2861de105534c80
2 files changed
tree: 79640e10c044960ceef3b5ce1f97c821a19095eb
  1. services/