+
+ /* failsafe against overload:
+ * will we exceed the limit set?
+ */
+ if ((MyQItem->ActiveDeliveries + mynumsessions > max_sessions_for_outbound_smtp) &&
+ /* if yes, did we reach more than half of the quota? */
+ ((mynumsessions * 2) > max_sessions_for_outbound_smtp) &&
+ /* if... would we ever fit into half of the quota?? */
+ (((MyQItem->ActiveDeliveries * 2) < max_sessions_for_outbound_smtp)))
+ {
+ /* abort delivery for another time. */
+ syslog(LOG_DEBUG,
+ "SMTP Queue: skipping because of num jobs %d + %ld > %d max_sessions_for_outbound_smtp",
+ mynumsessions,
+ MyQItem->ActiveDeliveries,
+ max_sessions_for_outbound_smtp);
+
+ FreeQueItem(&MyQItem);
+
+ return;
+ }
+
+