private void addConnection(Socket s) { lock (mutex) { int n = replicas.Length; Replica[] newReplicas = new Replica[n + 1]; Array.Copy(replicas, 0, newReplicas, 0, n); Replica replica = new Replica(); newReplicas[n] = replica; replica.host = s.RemoteEndPoint.ToString(); replica.socket = s; replica.isDynamic = true; replicas = newReplicas; nHosts += 1; SynchronizeThread syncThread = new SynchronizeThread(this, n); Thread t = new Thread(new ThreadStart(syncThread.run)); replica.syncThread = t; t.Start(); } }
private void addConnection(Socket s) { lock (mutex) { int n = replicas.Length; Replica[] newReplicas = new Replica[n+1]; Array.Copy(replicas, 0, newReplicas, 0, n); Replica replica = new Replica(); newReplicas[n] = replica; replica.host = s.RemoteEndPoint.ToString(); replica.socket = s; replica.isDynamic = true; replicas = newReplicas; nHosts += 1; SynchronizeThread syncThread = new SynchronizeThread(this, n); Thread t = new Thread(new ThreadStart(syncThread.run)); replica.syncThread = t; t.Start(); } }