Project

General

Profile

« Previous | Next » 

Revision 915089b7

Added by Ermal LUÇI over 13 years ago

Catch up with multiple events sending. Also do not blindly startup check_reload_status check first

View differences:

etc/inc/util.inc
154 154
				log_error("send_event: sent {$cmd} got {$resp}");
155 155
			fclose($fd);
156 156
			$try = 3;
157
		} else
157
		} else if (!is_process_running("check_reload_status"))
158 158
			mwexec_bg("/usr/bin/nice -n20 /usr/local/sbin/check_reload_status");
159 159
		$try++;
160 160
	}
......
169 169
	if (!is_array($cmds))
170 170
		return;
171 171

  
172
	foreach ($cmds as $cmd)
173
		send_event($cmd);
172
	while ($try < 3) {
173
		$fd = @fsockopen($g['event_address']);
174
		if ($fd) {
175
			foreach ($cmds as $cmd) {
176
				fwrite($fd, $cmd);
177
				$resp = fread($fd, 4096);
178
				if ($resp != "OK\n")
179
					log_error("send_event: sent {$cmd} got {$resp}");
180
			}
181
			fclose($fd);
182
			$try = 3;
183
		} else if (!is_process_running("check_reload_status"))
184
			mwexec_bg("/usr/bin/nice -n20 /usr/local/sbin/check_reload_status");
185
		$try++;
186
	}
174 187
}
175 188

  
176 189
function refcount_init($reference) {

Also available in: Unified diff