diff libfdcore/server.c @ 1194:48759e3f7611

Reject more quickly invalid messages if possible
author Sebastien Decugis <sdecugis@freediameter.net>
date Tue, 11 Jun 2013 10:05:50 +0800
parents 6a1042d8075b
children 9ff57791a5ab
line wrap: on
line diff
--- a/libfdcore/server.c	Tue Jun 11 09:18:52 2013 +0800
+++ b/libfdcore/server.c	Tue Jun 11 10:05:50 2013 +0800
@@ -154,6 +154,8 @@
 next_client:
 	LOG_A("Ready to process next incoming connection");
 
+	memset(&rcv_data, 0, sizeof(rcv_data));
+	
 	/* Get the next connection */
 	CHECK_FCT_DO( fd_fifo_get( s->pending, &c ), { fatal = 1; goto cleanup; } );
 
@@ -178,8 +180,6 @@
 	CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &ts), { fatal = 1; goto cleanup; } );
 	ts.tv_sec += INCNX_TIMEOUT;
 	
-	memset(&rcv_data, 0, sizeof(rcv_data));
-	
 	/* Receive the first Diameter message on the connection -- cleanup in case of timeout */
 	CHECK_FCT_DO( fd_cnx_receive(c, &ts, &rcv_data.buffer, &rcv_data.length), 
 		{
"Welcome to our mercurial repository"