Browse Source

-DDBG_MSG_QA introduced

Jiri Kuthan 23 years ago
parent
commit
92044adc66
1 changed files with 24 additions and 0 deletions
  1. 24 0
      udp_server.c

+ 24 - 0
udp_server.c

@@ -235,6 +235,30 @@ int udp_send(struct socket_info *source, char *buf, unsigned len,
 
 	int n;
 
+#ifdef DBG_MSG_QA
+	char *space;
+	int my_len;
+
+	if (memchr(buf, 0, len)) {
+		LOG(L_CRIT, "BUG: message being sent with 0 in it\n");
+		abort();
+	}
+	my_len=len;
+	space=buf;
+	while((space=memchr(space, ' ', my_len ))) {
+		/* how much we have after the space */
+		my_len=len-(space-buf)+1;
+		/* EoM -- stop checks */
+		if (my_len<3) break;
+		if (memcmp(space+1, "   ", 3)==0) {
+			LOG(L_CRIT, "BUG(probably): "
+				"message with four spaces in it\n");
+			abort();
+		}
+		space+=3;my_len-=3;
+	}
+#endif
+
 again:
 	n=sendto(source->socket, buf, len, 0, &to->s, tolen);
 	if (n==-1){