OPTIM: server: publish UP/DOWN events from STATE change

Reuse cb_data from STATE event to publish UP and DOWN events.
This saves some CPU time since the event is only constructed
once to publish STATE, STATE+UP or STATE+DOWN depending on the
state change.
diff --git a/src/server.c b/src/server.c
index 5bc73cc..83faf6b 100644
--- a/src/server.c
+++ b/src/server.c
@@ -5349,9 +5349,6 @@
 		 */
 		xferred = pendconn_redistribute(s);
 
-		/* no maintenance + server DOWN: publish event SERVER DOWN */
-		srv_event_hdl_publish(EVENT_HDL_SUB_SERVER_DOWN, s, 0);
-
 		tmptrash = alloc_trash_chunk();
 		if (tmptrash) {
 			chunk_printf(tmptrash,
@@ -5420,9 +5417,6 @@
 		 */
 		xferred = pendconn_grab_from_px(s);
 
-		/* no maintenance + server going UP: publish event SERVER UP */
-		srv_event_hdl_publish(EVENT_HDL_SUB_SERVER_UP, s, 0);
-
 		tmptrash = alloc_trash_chunk();
 		if (tmptrash) {
 			chunk_printf(tmptrash,
@@ -5504,9 +5498,6 @@
 			 */
 			xferred = pendconn_redistribute(s);
 
-			/* maintenance on previously running server: publish event SERVER DOWN */
-			srv_event_hdl_publish(EVENT_HDL_SUB_SERVER_DOWN, s, 0);
-
 			tmptrash = alloc_trash_chunk();
 			if (tmptrash) {
 				chunk_printf(tmptrash,
@@ -5565,12 +5556,6 @@
 
 		}
 
-		/* ignore if server stays down when leaving maintenance mode */
-		if (s->next_state != SRV_ST_STOPPED) {
-			/* leaving maintenance + server UP: publish event SERVER UP */
-			srv_event_hdl_publish(EVENT_HDL_SUB_SERVER_UP, s, 0);
-		}
-
 		tmptrash = alloc_trash_chunk();
 		if (tmptrash) {
 			if (!(s->next_admin & SRV_ADMF_FMAINT) && (s->cur_admin & SRV_ADMF_FMAINT)) {
@@ -5814,10 +5799,12 @@
 			/* server was down and no longer is */
 			if (s->last_change < ns_to_sec(now_ns))                        // ignore negative times
 				s->down_time += ns_to_sec(now_ns) - s->last_change;
+			_srv_event_hdl_publish(EVENT_HDL_SUB_SERVER_UP, cb_data.common, s);
 		}
 		else if (s->cur_state == SRV_ST_STOPPED) {
 			/* server was up and is currently down */
 			s->counters.down_trans++;
+			_srv_event_hdl_publish(EVENT_HDL_SUB_SERVER_DOWN, cb_data.common, s);
 		}
 		s->last_change = ns_to_sec(now_ns);