comparison libfdcore/cnxctx.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 8c4dd4b693c6
comparison
equal deleted inserted replaced
1193:60e7b02a3ce7 1194:48759e3f7611
805 if (ret <= 0) { 805 if (ret <= 0) {
806 goto out; /* Stop the thread, the event was already sent */ 806 goto out; /* Stop the thread, the event was already sent */
807 } 807 }
808 808
809 received += ret; 809 received += ret;
810
811 if (header[0] != DIAMETER_VERSION)
812 break; /* No need to wait for 4 bytes in this case */
810 } while (received < sizeof(header)); 813 } while (received < sizeof(header));
811 814
812 rcv_data.length = ((size_t)header[1] << 16) + ((size_t)header[2] << 8) + (size_t)header[3]; 815 rcv_data.length = ((size_t)header[1] << 16) + ((size_t)header[2] << 8) + (size_t)header[3];
813 816
814 /* Check the received word is a valid begining of a Diameter message */ 817 /* Check the received word is a valid begining of a Diameter message */
"Welcome to our mercurial repository"