Add Peer ID for PicoTorrent

Based on information from https://github.com/picotorrent/picotorrent and
http://www.picotorrent.org/.

PicoTorrent uses Azureus-style peer ID: -PI-. Example: -PI0091- (major:
0, minor: 09, patch: 1).
This commit is contained in:
Dhiru Kholia 2017-05-20 17:25:15 +05:30
parent 4df187885f
commit dda33afbe0
2 changed files with 8 additions and 0 deletions

View File

@ -36,6 +36,10 @@ int main(void)
/* Older Xfplay versions have three digit version number */
TEST_CLIENT("-XF9990-", "Xfplay 9.9.9");
/* PicoTorrent */
TEST_CLIENT("-PI0091-", "PicoTorrent 0.09.1");
TEST_CLIENT("-PI0120-", "PicoTorrent 0.12.0");
/* gobbledygook */
TEST_CLIENT("-IIO\x10\x2D\x04-", "-IIO%10-%04-");
TEST_CLIENT("-I\05O\x08\x03\x01-", "-I%05O%08%03%01-");

View File

@ -599,6 +599,10 @@ char* tr_clientForId(char* buf, size_t buflen, void const* id_in)
tr_snprintf(buf, buflen, "Xfplay %d.%d.%d", strint(id + 3, 1), strint(id + 4, 1), strint(id + 5, 2));
}
}
else if (strncmp(chid + 1, "PI", 2) == 0)
{
tr_snprintf(buf, buflen, "PicoTorrent %d.%d%d.%d", charint(id[3]), charint(id[4]), charint(id[5]), charint(id[6]));
}
if (*buf != '\0')
{