[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r556 - GNUnet/src/transports
From: |
grothoff |
Subject: |
[GNUnet-SVN] r556 - GNUnet/src/transports |
Date: |
Fri, 1 Apr 2005 16:46:02 -0800 (PST) |
Author: grothoff
Date: 2005-04-01 16:46:00 -0800 (Fri, 01 Apr 2005)
New Revision: 556
Modified:
GNUnet/src/transports/tcp.c
Log:
fix
Modified: GNUnet/src/transports/tcp.c
===================================================================
--- GNUnet/src/transports/tcp.c 2005-04-02 00:38:39 UTC (rev 555)
+++ GNUnet/src/transports/tcp.c 2005-04-02 00:46:00 UTC (rev 556)
@@ -62,7 +62,7 @@
*/
typedef struct {
/**
- * size of the message, in bytes, including this header;
+ * size of the message, in bytes, excluding this header;
* max 65535; we do NOT want to make this field an int
* because then a malicious peer could cause us to allocate
* lots of memory -- this bounds it by 64k/peer.
@@ -86,17 +86,9 @@
* must match the CS_HEADER since we are using tcpio.
*/
typedef struct {
- /**
- * size of the handshake message, in nbo, value is 24
- */
- unsigned short size;
+ TCPMessagePack header;
/**
- * "message type", TCP version number, always 0.
- */
- unsigned short version;
-
- /**
* Identity of the node connecting (TCP client)
*/
PeerIdentity clientIdentity;
@@ -448,12 +440,12 @@
#endif
welcome = (TCPWelcome*) &tcpSession->rbuff[0];
- if ( (ntohs(welcome->version) != 0) ||
- (ntohs(welcome->size) != sizeof(TCPWelcome)) ) {
+ if ( (ntohs(welcome->header.version) != 0) ||
+ (ntohs(welcome->header.size) != sizeof(TCPWelcome) -
sizeof(TCPMessagePack)) ) {
LOG(LOG_WARNING,
_("Expected welcome message on tcp connection, got garbage (%u,
%u). Closing.\n"),
- ntohs(welcome->version),
- ntohs(welcome->size));
+ ntohs(welcome->header.version),
+ ntohs(welcome->header.size));
tcpDisconnect(tsession);
return SYSERR;
}
@@ -1088,8 +1080,8 @@
/* send our node identity to the other side to fully establish the
connection! */
- welcome.size = htons(sizeof(TCPWelcome));
- welcome.version = htons(0);
+ welcome.header.size = htons(sizeof(TCPWelcome) - sizeof(TCPMessagePack));
+ welcome.header.version = htons(0);
welcome.clientIdentity = *(coreAPI->myIdentity);
if (SYSERR == tcpDirectSend(tcpSession,
&welcome,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r556 - GNUnet/src/transports,
grothoff <=