From f341d685cc6170e656a7d8b11c3358aa6bd3b929 Mon Sep 17 00:00:00 2001 From: Sree Harsha Totakura Date: Fri, 9 Mar 2012 08:50:42 +0000 Subject: [PATCH] corrected HELLO_ACK message size --- src/stream/stream_api.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/stream/stream_api.c b/src/stream/stream_api.c index 4014f4957..8d09474c4 100644 --- a/src/stream/stream_api.c +++ b/src/stream/stream_api.c @@ -970,7 +970,7 @@ handle_data (struct GNUNET_STREAM_Socket *socket, case STATE_ESTABLISHED: case STATE_TRANSMIT_CLOSED: case STATE_TRANSMIT_CLOSE_WAIT: - + /* check if the message's sequence number is in the range we are expecting */ relative_sequence_number = @@ -984,6 +984,14 @@ handle_data (struct GNUNET_STREAM_Socket *socket, return GNUNET_YES; } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "%x: Receiving DATA with sequence number: %u and size: %d " + "from %x\n", + socket->our_id, + ntohl (msg->sequence_number), + ntohs (msg->header.header.size), + socket->other_peer); + /* Check if we have to allocate the buffer */ size -= sizeof (struct GNUNET_STREAM_DataMessage); relative_offset = ntohl (msg->offset) - socket->read_offset; @@ -1181,7 +1189,7 @@ client_handle_hello_ack (void *cls, reply = GNUNET_malloc (sizeof (struct GNUNET_STREAM_HelloAckMessage)); reply->header.header.size = - htons (sizeof (struct GNUNET_STREAM_MessageHeader)); + htons (sizeof (struct GNUNET_STREAM_HelloAckMessage)); reply->header.header.type = htons (GNUNET_MESSAGE_TYPE_STREAM_HELLO_ACK); reply->sequence_number = htonl (socket->write_sequence_number); @@ -1508,11 +1516,6 @@ server_handle_hello (void *cls, socket->our_id, socket->other_peer); - /* Catch possible protocol breaks */ - GNUNET_break_op (0 == memcmp (&socket->other_peer, - sender, - sizeof (struct GNUNET_PeerIdentity))); - if (STATE_INIT == socket->state) { /* Get the random sequence number */ @@ -1525,7 +1528,7 @@ server_handle_hello (void *cls, reply = GNUNET_malloc (sizeof (struct GNUNET_STREAM_HelloAckMessage)); reply->header.header.size = - htons (sizeof (struct GNUNET_STREAM_MessageHeader)); + htons (sizeof (struct GNUNET_STREAM_HelloAckMessage)); reply->header.header.type = htons (GNUNET_MESSAGE_TYPE_STREAM_HELLO_ACK); reply->sequence_number = htonl (socket->write_sequence_number); @@ -1574,6 +1577,10 @@ server_handle_hello_ack (void *cls, ack_message = (struct GNUNET_STREAM_HelloAckMessage *) message; if (STATE_HELLO_WAIT == socket->state) { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "%x: Received HELLO_ACK from %x\n", + socket->our_id, + socket->other_peer); socket->read_sequence_number = ntohl (ack_message->sequence_number); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%x: Read sequence number %u\n", -- 2.25.1