~ubuntu-branches/ubuntu/trusty/syslog-ng/trusty-proposed

« back to all changes in this revision

Viewing changes to src/logwriter.c

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2010-08-04 17:17:51 UTC
  • mfrom: (1.3.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100804171751-5bvfxhlc5xrmi3n8
Tags: 3.1.2-1
* New upstream release. 
* Update to Standards-Version 3.9.1 .
* Build depend on libcap-dev to add capability support on Linux archs.
* Disable statistics logging (closes: #586749) and restore logging to
  /var/log/syslog .

Show diffs side-by-side

added added

removed removed

Lines of Context:
159
159
        }
160
160
      else
161
161
        {
162
 
          *timeout = g_time_val_diff(&self->flush_target, &now) / 1000;
163
 
          if (*timeout < 0)
164
 
            return TRUE;
 
162
          glong to = g_time_val_diff(&self->flush_target, &now) / 1000;
 
163
          if (to <= 0)
 
164
            {
 
165
              /* timeout elapsed, start polling again */
 
166
              if (self->writer->flags & LW_ALWAYS_WRITABLE)
 
167
                return TRUE;
 
168
              self->pollfd.events = proto_cond;
 
169
            }
 
170
          else
 
171
            {
 
172
              *timeout = to;
 
173
            }
165
174
        }
166
175
      return FALSE;
167
176
    }
213
222
      if (self->flush_waiting_for_timeout)
214
223
        {
215
224
          GTimeVal tv;
 
225
 
216
226
          /* check if timeout elapsed */
217
227
          g_source_get_current_time(source, &tv);
218
 
          return self->flush_target.tv_sec <= tv.tv_sec || (self->flush_target.tv_sec == tv.tv_sec && self->flush_target.tv_usec <= tv.tv_usec);
 
228
          if (!(self->flush_target.tv_sec <= tv.tv_sec || (self->flush_target.tv_sec == tv.tv_sec && self->flush_target.tv_usec <= tv.tv_usec)))
 
229
            return FALSE;
 
230
          if ((self->writer->flags & LW_ALWAYS_WRITABLE))
 
231
            return TRUE;
219
232
        }
220
233
    }
221
234
  return !!(self->pollfd.revents & (G_IO_OUT | G_IO_ERR | G_IO_HUP | G_IO_IN));
350
363
  log_msg_set_value(m, LM_V_MESSAGE, buf, len);
351
364
 
352
365
  path_options.flow_control = FALSE;
353
 
  log_queue_push_tail(self->queue, m, &path_options);
 
366
  if (!log_queue_push_tail(self->queue, m, &path_options))
 
367
    {
 
368
      stats_counter_inc(self->dropped_messages);
 
369
      msg_debug("Destination queue full, dropping suppressed message",
 
370
                evt_tag_int("queue_len", log_queue_get_length(self->queue)),
 
371
                evt_tag_int("mem_fifo_size", self->options->mem_fifo_size),
 
372
                NULL);
 
373
      log_msg_drop(m, &path_options);
 
374
    }
354
375
 
355
376
  log_writer_last_msg_release(self);
356
377
}
729
750
        {
730
751
          /* push back to the queue */
731
752
          log_queue_push_head(self->queue, lm, &path_options);
 
753
 
 
754
          /* force exit of the loop */
 
755
          num_elements = 1;
732
756
        }
733
757
        
734
758
      msg_set_context(NULL);