|
@@ -173,6 +173,9 @@ drain:
|
|
}
|
|
}
|
|
|
|
|
|
func (s *journald) followJournal(logWatcher *logger.LogWatcher, config logger.ReadConfig, j *C.sd_journal, pfd [2]C.int, cursor string) {
|
|
func (s *journald) followJournal(logWatcher *logger.LogWatcher, config logger.ReadConfig, j *C.sd_journal, pfd [2]C.int, cursor string) {
|
|
|
|
+ s.readers.mu.Lock()
|
|
|
|
+ s.readers.readers[logWatcher] = logWatcher
|
|
|
|
+ s.readers.mu.Unlock()
|
|
go func() {
|
|
go func() {
|
|
// Keep copying journal data out until we're notified to stop.
|
|
// Keep copying journal data out until we're notified to stop.
|
|
for C.wait_for_data_or_close(j, pfd[0]) == 1 {
|
|
for C.wait_for_data_or_close(j, pfd[0]) == 1 {
|
|
@@ -184,9 +187,6 @@ func (s *journald) followJournal(logWatcher *logger.LogWatcher, config logger.Re
|
|
delete(s.readers.readers, logWatcher)
|
|
delete(s.readers.readers, logWatcher)
|
|
s.readers.mu.Unlock()
|
|
s.readers.mu.Unlock()
|
|
}()
|
|
}()
|
|
- s.readers.mu.Lock()
|
|
|
|
- s.readers.readers[logWatcher] = logWatcher
|
|
|
|
- s.readers.mu.Unlock()
|
|
|
|
// Wait until we're told to stop.
|
|
// Wait until we're told to stop.
|
|
select {
|
|
select {
|
|
case <-logWatcher.WatchClose():
|
|
case <-logWatcher.WatchClose():
|