fixed few small issues

pull/11/head
orignal 11 years ago
parent b02b88627b
commit 991a80428d

@ -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
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
{
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;

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

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

@ -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