Browse Source

fixed few small issues

pull/11/merge
orignal 11 years ago
parent
commit
991a80428d
  1. 6
      NTCPSession.cpp
  2. 2
      RouterInfo.h
  3. 8
      Streaming.cpp
  4. 2
      Streaming.h

6
NTCPSession.cpp

@ -1,13 +1,13 @@ @@ -1,13 +1,13 @@
#include <string.h>
#include <stdlib.h>
#include "I2PEndian.h"
#include <time.h>
#include <boost/bind.hpp>
#include <cryptopp/dh.h>
#include <cryptopp/secblock.h>
#include <cryptopp/dsa.h>
#include "base64.h"
#include "Log.h"
#include "Timestamp.h"
#include "CryptoConst.h"
#include "I2NPProtocol.h"
#include "RouterContext.h"
@ -149,7 +149,7 @@ namespace ntcp @@ -149,7 +149,7 @@ namespace ntcp
memcpy (xy, m_Phase1.pubKey, 256);
memcpy (xy + 256, y, 256);
CryptoPP::SHA256().CalculateDigest(m_Phase2.encrypted.hxy, xy, 512);
uint32_t tsB = htobe32 (time(0));
uint32_t tsB = htobe32 (i2p::util::GetSecondsSinceEpoch ());
m_Phase2.encrypted.timestamp = tsB;
// TODO: fill filler
@ -217,7 +217,7 @@ namespace ntcp @@ -217,7 +217,7 @@ namespace ntcp
{
m_Phase3.size = htons (sizeof (m_Phase3.ident));
memcpy (&m_Phase3.ident, &i2p::context.GetRouterIdentity (), sizeof (m_Phase3.ident));
uint32_t tsA = htobe32 (time(0));
uint32_t tsA = htobe32 (i2p::util::GetSecondsSinceEpoch ());
m_Phase3.timestamp = tsA;
SignedData s;

2
RouterInfo.h

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
#include <vector>
#include <iostream>
#include <boost/asio.hpp>
#include "LeaseSet.h"
#include "Identity.h"
namespace i2p
{

8
Streaming.cpp

@ -24,6 +24,8 @@ namespace stream @@ -24,6 +24,8 @@ namespace stream
{
const uint8_t * end = buf + len;
buf += 4; // sendStreamID
if (!m_SendStreamID)
m_SendStreamID = be32toh (*(uint32_t *)buf);
buf += 4; // receiveStreamID
buf += 4; // sequenceNum
buf += 4; // ackThrough
@ -150,10 +152,10 @@ namespace stream @@ -150,10 +152,10 @@ namespace stream
I2NPMessage * StreamingDestination::GetLeaseSet ()
{
if (!m_LeaseSet)
if (m_LeaseSet) // temporary always create new LeaseSet
DeleteI2NPMessage (m_LeaseSet);
m_LeaseSet = CreateLeaseSet ();
else
FillI2NPMessageHeader (m_LeaseSet, eI2NPDatabaseStore); // refresh msgID
return m_LeaseSet;
}

2
Streaming.h

@ -35,7 +35,7 @@ namespace stream @@ -35,7 +35,7 @@ namespace stream
uint32_t GetSendStreamID () const { return m_SendStreamID; };
uint32_t GetRecvStreamID () const { return m_RecvStreamID; };
const i2p::data::LeaseSet * GetRemoteLeaseSet () const { return m_RemoteLeaseSet; };
bool IsEstablished () const { return !m_SendStreamID; };
bool IsEstablished () const { return m_SendStreamID; };
void HandleNextPacket (const uint8_t * buf, size_t len);
size_t Send (uint8_t * buf, size_t len, int timeout); // timeout in seconds

Loading…
Cancel
Save