| 437 | } |
| 438 | |
| 439 | func (s *Sync) watchOutgoing(st Stream) { |
| 440 | ch := make(chan changes.Change, 1) |
| 441 | |
| 442 | go func() { |
| 443 | if err := changes.Watch(s.Local, ch, changes.WatchOptions{Ignores: s.ignores}); err != nil { |
| 444 | st <- fmt.Sprintf("error: %s", err) |
| 445 | } |
| 446 | }() |
| 447 | |
| 448 | for c := range ch { |
| 449 | s.lock.Lock() |
| 450 | if s.outgoingBlocks[c.Path] > 0 { |
| 451 | s.outgoingBlocks[c.Path]-- |
| 452 | s.lock.Unlock() |
| 453 | } else { |
| 454 | s.lock.Unlock() |
| 455 | s.outgoing <- c |
| 456 | } |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | func inspectExec(id string, s *Sync, state chan execState, done chan struct{}) { |
| 461 | |