[CLEANUP] stream_sock: move the write-nothing condition out of the loop

Some tricks to handle situations where we write nothing were in the
middle of the main loop in stream_sock_write(). This cleanup provides
better source and object code, and slightly shrinks the output code.
diff --git a/src/stream_sock.c b/src/stream_sock.c
index 3d0845c..e006797 100644
--- a/src/stream_sock.c
+++ b/src/stream_sock.c
@@ -361,7 +361,7 @@
 			 * so we cannot write anything from the buffer. Let's disable
 			 * the write event and pretend we never came there.
 			 */
-			goto write_nothing;
+			goto out_stop_write;
 		}
 
 #ifndef MSG_NOSIGNAL
@@ -398,25 +398,7 @@
 
 			if (!b->l && !b->splice_len) {
 				b->flags |= BF_EMPTY;
-
-			write_nothing:
-				/* Maybe we just wrote the last chunk and need to close ? */
-				if ((b->flags & (BF_SHUTW|BF_EMPTY|BF_HIJACK|BF_WRITE_ENA|BF_SHUTR)) == (BF_EMPTY|BF_WRITE_ENA|BF_SHUTR)) {
-					if (si->state == SI_ST_EST) {
-						stream_sock_shutw(si);
-						b->wex = TICK_ETERNITY;
-						goto out_wakeup;
-					}
-				}
-
-				/* we may either get there when the buffer is empty or when
-				 * we refrain from sending due to send_max reached.
-				 */
-				if (!b->l && !b->splice_len)
-					si->flags |= SI_FL_WAIT_DATA;
-				EV_FD_CLR(fd, DIR_WR);
-				b->wex = TICK_ETERNITY;
-				goto out_wakeup;
+				goto out_stop_write;
 			}
 
 			/* if the system buffer is full, don't insist */
@@ -479,6 +461,22 @@
 	fdtab[fd].ev &= ~FD_POLL_OUT;
 	return retval;
 
+ out_stop_write:
+	/* We can't write anymore. Either the buffer is empty, or we just
+	 * refrain from sending because send_max is reached. Maybe we just
+	 * wrote the last chunk and need to close.
+	 */
+	if ((b->flags & (BF_SHUTW|BF_EMPTY|BF_HIJACK|BF_WRITE_ENA|BF_SHUTR)) == (BF_EMPTY|BF_WRITE_ENA|BF_SHUTR) &&
+	    (si->state == SI_ST_EST)) {
+		stream_sock_shutw(si);
+	} else {
+		if (!b->l && !b->splice_len)
+			si->flags |= SI_FL_WAIT_DATA;
+		EV_FD_CLR(fd, DIR_WR);
+	}
+	b->wex = TICK_ETERNITY;
+	goto out_wakeup;
+
  out_error:
 	/* Write error on the file descriptor. We mark the FD as STERROR so
 	 * that we don't use it anymore. The error is reported to the stream