|
|
|
@ -160,24 +160,6 @@ namespace i2p
@@ -160,24 +160,6 @@ namespace i2p
|
|
|
|
|
return m; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void HandleDatabaseLookupMsg (uint8_t * buf, size_t len) |
|
|
|
|
{ |
|
|
|
|
char key[48]; |
|
|
|
|
int l = i2p::data::ByteStreamToBase64 (buf, 32, key, 48); |
|
|
|
|
key[l] = 0; |
|
|
|
|
LogPrint ("DatabaseLookup for ", key, " recieved"); |
|
|
|
|
uint8_t flag = buf[64]; |
|
|
|
|
uint32_t replyTunnelID = 0; |
|
|
|
|
if (flag & 0x01) //reply to yunnel
|
|
|
|
|
replyTunnelID = be32toh (*(uint32_t *)(buf + 64)); |
|
|
|
|
// TODO: implement search. We send non-found for now
|
|
|
|
|
I2NPMessage * replyMsg = CreateDatabaseSearchReply (buf); |
|
|
|
|
if (replyTunnelID) |
|
|
|
|
i2p::tunnel::tunnels.GetNextOutboundTunnel ()->SendTunnelDataMsg (buf+32, replyTunnelID, replyMsg); |
|
|
|
|
else |
|
|
|
|
i2p::transports.SendMessage (buf, replyMsg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
I2NPMessage * CreateDatabaseSearchReply (const i2p::data::IdentHash& ident) |
|
|
|
|
{ |
|
|
|
|
I2NPMessage * m = NewI2NPMessage (); |
|
|
|
@ -498,10 +480,6 @@ namespace i2p
@@ -498,10 +480,6 @@ namespace i2p
|
|
|
|
|
LogPrint ("TunnelBuildReply"); |
|
|
|
|
// TODO:
|
|
|
|
|
break; |
|
|
|
|
case eI2NPDatabaseLookup: |
|
|
|
|
LogPrint ("DatabaseLookup"); |
|
|
|
|
HandleDatabaseLookupMsg (buf, size); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
LogPrint ("Unexpected message ", (int)header->typeID); |
|
|
|
|
} |
|
|
|
@ -533,6 +511,10 @@ namespace i2p
@@ -533,6 +511,10 @@ namespace i2p
|
|
|
|
|
LogPrint ("DatabaseSearchReply"); |
|
|
|
|
i2p::data::netdb.PostI2NPMsg (msg); |
|
|
|
|
break; |
|
|
|
|
case eI2NPDatabaseLookup: |
|
|
|
|
LogPrint ("DatabaseLookup"); |
|
|
|
|
i2p::data::netdb.PostI2NPMsg (msg); |
|
|
|
|
break; |
|
|
|
|
case eI2NPDeliveryStatus: |
|
|
|
|
LogPrint ("DeliveryStatus"); |
|
|
|
|
if (msg->from && msg->from->GetTunnelPool ()) |
|
|
|
|