Merge branch 'adamierymenko-dev' into android-jni

This commit is contained in:
Grant Limberg 2015-06-09 19:38:47 -07:00
commit 60da0e6cae
4 changed files with 61 additions and 51 deletions

38
AUTHORS.md Normal file
View File

@ -0,0 +1,38 @@
## Authors
* ZeroTier protocol design and core network virtualization engine, ZeroTier One service, React web UI, packaging for most platforms, kitchen sink...<br>
Adam Ierymenko / adam.ierymenko@zerotier.com
* Java JNI Interface to enable Android application development, and Android app itself (code for that is elsewhere)<br>
Grant Limberg / glimberg@gmail.com
## Contributors
* Debugging and testing, OpenWRT support fixes.<br>
Moritz Warning / moritzwarning@web.de
* Several others made smaller contributions, which GitHub tracks here:<br>
https://github.com/zerotier/ZeroTierOne/graphs/contributors
## Third Party Code
* LZ4 compression algorithm by Yann Collet (BSD license)<br>
http://code.google.com/p/lz4/
* http-parser by many authors (MIT license)<br>
https://github.com/joyent/http-parser
* json-parser by James McLaughlin (BSD license)<br>
https://github.com/udp/json-parser
* TunTapOSX by Mattias Nissler (BSD license)<br>
http://tuntaposx.sourceforge.net
* tap-windows and tap-windows6 by the OpenVPN project (GPL)<br>
https://github.com/OpenVPN/tap-windows<br>
https://github.com/OpenVPN/tap-windows6
* Salsa20 stream cipher, Curve25519 elliptic curve cipher, Ed25519
digital signature algorithm, and Poly1305 MAC algorithm, all by
Daniel J. Bernstein (public domain)<br>
http://cr.yp.to/

View File

@ -1,27 +0,0 @@
ZeroTier One is designed and written by Adam Ierymenko, with a few bug
fixes and other contributions from other users. Information about all
contributors can be found on the GitHub home page at:
https://github.com/zerotier/ZeroTierOne
ZeroTier One includes the following third party code:
* LZ4 compression algorithm by Yann Collet (BSD license)
http://code.google.com/p/lz4/
* http-parser by many authors (MIT license)
https://github.com/joyent/http-parser
* json-parser by James McLaughlin (BSD license)
https://github.com/udp/json-parser
* TunTapOSX by Mattias Nissler (forked for ZT1) (BSD license)
http://tuntaposx.sourceforge.net
* tap-windows by the OpenVPN project (forked for ZT1) (GPL)
https://github.com/OpenVPN/tap-windows
* Salsa20 stream cipher, Curve25519 elliptic curve cipher, Ed25519
digital signature algorithm, and Poly1305 MAC algorithm, all by
Daniel J. Bernstein (public domain)
http://cr.yp.to/

View File

@ -23,7 +23,7 @@
<ROW Property="CTRLS" Value="2"/> <ROW Property="CTRLS" Value="2"/>
<ROW Property="MSIFASTINSTALL" MultiBuildValue="DefaultBuild:2"/> <ROW Property="MSIFASTINSTALL" MultiBuildValue="DefaultBuild:2"/>
<ROW Property="Manufacturer" Value="ZeroTier, Inc."/> <ROW Property="Manufacturer" Value="ZeroTier, Inc."/>
<ROW Property="ProductCode" Value="1033:{D0B06684-2CB3-4EA8-BC7F-FC24F2C6DA40} " Type="16"/> <ROW Property="ProductCode" Value="1033:{CEB9F664-D7D0-446A-BAB0-CDC553ADC137} " Type="16"/>
<ROW Property="ProductLanguage" Value="1033"/> <ROW Property="ProductLanguage" Value="1033"/>
<ROW Property="ProductName" Value="ZeroTier One"/> <ROW Property="ProductName" Value="ZeroTier One"/>
<ROW Property="ProductVersion" Value="1.0.3" Type="32"/> <ROW Property="ProductVersion" Value="1.0.3" Type="32"/>

View File

@ -123,12 +123,13 @@ private:
enum PhySocketType enum PhySocketType
{ {
ZT_PHY_SOCKET_TCP_OUT_PENDING = 0x00, ZT_PHY_SOCKET_CLOSED = 0x00, // socket is closed, will be removed on next poll()
ZT_PHY_SOCKET_TCP_OUT_CONNECTED = 0x01, ZT_PHY_SOCKET_TCP_OUT_PENDING = 0x01,
ZT_PHY_SOCKET_TCP_IN = 0x02, ZT_PHY_SOCKET_TCP_OUT_CONNECTED = 0x02,
ZT_PHY_SOCKET_TCP_LISTEN = 0x03, ZT_PHY_SOCKET_TCP_IN = 0x03,
ZT_PHY_SOCKET_RAW = 0x04, ZT_PHY_SOCKET_TCP_LISTEN = 0x04,
ZT_PHY_SOCKET_UDP = 0x05 ZT_PHY_SOCKET_RAW = 0x05,
ZT_PHY_SOCKET_UDP = 0x06
}; };
struct PhySocketImpl struct PhySocketImpl
@ -205,8 +206,10 @@ public:
~Phy() ~Phy()
{ {
while (!_socks.empty()) for(typename std::list<PhySocketImpl>::const_iterator s(_socks.begin());s!=_socks.end();++s) {
this->close((PhySocket *)&(_socks.front()),true); if (s->type != ZT_PHY_SOCKET_CLOSED)
this->close((PhySocket *)&(*s),true);
}
ZT_PHY_CLOSE_SOCKET(_whackReceiveSocket); ZT_PHY_CLOSE_SOCKET(_whackReceiveSocket);
ZT_PHY_CLOSE_SOCKET(_whackSendSocket); ZT_PHY_CLOSE_SOCKET(_whackSendSocket);
} }
@ -620,11 +623,7 @@ public:
#endif #endif
} }
bool atEnd = false; for(typename std::list<PhySocketImpl>::iterator s(_socks.begin());s!=_socks.end();) {
for(typename std::list<PhySocketImpl>::iterator s(_socks.begin()),nexts;(!atEnd);s=nexts) {
nexts = s; ++nexts; // we can delete the linked list item, so traverse now
atEnd = (nexts == _socks.end()); // if we delete the last element, s!=_socks.end() will no longer terminate our loop
switch (s->type) { switch (s->type) {
case ZT_PHY_SOCKET_TCP_OUT_PENDING: case ZT_PHY_SOCKET_TCP_OUT_PENDING:
@ -724,6 +723,10 @@ public:
break; break;
} }
if (s->type == ZT_PHY_SOCKET_CLOSED)
_socks.erase(s++);
else ++s;
} }
} }
@ -736,6 +739,8 @@ public:
if (!sock) if (!sock)
return; return;
PhySocketImpl &sws = *(reinterpret_cast<PhySocketImpl *>(sock)); PhySocketImpl &sws = *(reinterpret_cast<PhySocketImpl *>(sock));
if (sws.type == ZT_PHY_SOCKET_CLOSED)
return;
FD_CLR(sws.sock,&_readfds); FD_CLR(sws.sock,&_readfds);
FD_CLR(sws.sock,&_writefds); FD_CLR(sws.sock,&_writefds);
@ -765,21 +770,15 @@ public:
break; break;
} }
long oldSock = (long)sws.sock; // Causes entry to be deleted from list in poll(), ignored elsewhere
sws.type = ZT_PHY_SOCKET_CLOSED;
for(typename std::list<PhySocketImpl>::iterator s(_socks.begin());s!=_socks.end();++s) { if (sws.sock >= _nfds) {
if (reinterpret_cast<PhySocket *>(&(*s)) == sock) {
_socks.erase(s);
break;
}
}
if (oldSock >= _nfds) {
long nfds = (long)_whackSendSocket; long nfds = (long)_whackSendSocket;
if ((long)_whackReceiveSocket > nfds) if ((long)_whackReceiveSocket > nfds)
nfds = (long)_whackReceiveSocket; nfds = (long)_whackReceiveSocket;
for(typename std::list<PhySocketImpl>::iterator s(_socks.begin());s!=_socks.end();++s) { for(typename std::list<PhySocketImpl>::iterator s(_socks.begin());s!=_socks.end();++s) {
if ((long)s->sock > nfds) if ((s->type != ZT_PHY_SOCKET_CLOSED)&&((long)s->sock > nfds))
nfds = (long)s->sock; nfds = (long)s->sock;
} }
_nfds = nfds; _nfds = nfds;