diff --git a/DPlusAuthenticator.cpp b/DPlusAuthenticator.cpp index 306cfa5..98b03b4 100644 --- a/DPlusAuthenticator.cpp +++ b/DPlusAuthenticator.cpp @@ -55,11 +55,12 @@ bool CDPlusAuthenticator::Process(std::map &gwy_map, c hints.ai_socktype = SOCK_STREAM; int result = EAI_AGAIN; - while (EAI_AGAIN == result) { + int count = 0; + while (EAI_AGAIN==result && 20>count++) { // we'll wait up to 60 seconds for this to work result = getaddrinfo(m_address.c_str(), NULL, &hints, &infoptr); if (EAI_AGAIN == result) { fprintf(stdout, "getaddrinfo not ready: please wait...\n"); - std::this_thread::sleep_for(std::chrono::seconds(5)); + std::this_thread::sleep_for(std::chrono::seconds(3)); } } if (result) { diff --git a/QnetLink.cpp b/QnetLink.cpp index e962c6e..2dfc28c 100644 --- a/QnetLink.cpp +++ b/QnetLink.cpp @@ -66,6 +66,7 @@ CQnetLink::CQnetLink() CQnetLink::~CQnetLink() { + speak.clear(); } bool CQnetLink::resolve_rmt(char *name, int type, struct sockaddr_in *addr) @@ -3596,6 +3597,24 @@ bool CQnetLink::Init(const char *cfgfile) printf("srv_open() failed\n"); return true; } + + speak.resize(62); + std::string index(announce_dir); + index.append("/speak.index"); + std::ifstream voicefile(index.c_str(), std::ifstream::in); + if (voicefile) { + for (int i=0; i<62; i++) { + std::string name, offset, size; + voicefile >> name >> offset >> size; + if (name.size() && offset.size() && size.size()) { + unsigned long of = std::stoul(offset); + unsigned long sz = std::stoul(size); + speak[i] = 1000U * of + sz; + printf("%s at %ld, %ld long\n", name.c_str(), of, sz); + } + } + voicefile.close(); + } return false; } diff --git a/QnetLink.h b/QnetLink.h index 2b4cb08..5155276 100644 --- a/QnetLink.h +++ b/QnetLink.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -173,4 +174,6 @@ private: } old_sid[3]; CRandom Random; + + std::vector speak; }; diff --git a/announce/speak.dat b/announce/speak.dat new file mode 100644 index 0000000..046de16 Binary files /dev/null and b/announce/speak.dat differ diff --git a/announce/speak.index b/announce/speak.index new file mode 100644 index 0000000..30996eb --- /dev/null +++ b/announce/speak.index @@ -0,0 +1,63 @@ +A 0 29 +B 30 32 +C 63 34 +D 98 32 +E 131 26 +F 158 31 +G 190 36 +H 227 31 +I 259 28 +J 288 36 +K 325 28 +L 354 28 +M 383 34 +N 418 32 +O 451 29 +P 481 32 +Q 514 34 +R 549 29 +S 579 33 +T 613 28 +U 642 24 +V 667 44 +W 712 40 +X 753 33 +Y 787 31 +Z 819 36 +alpha 856 38 +bravo 895 38 +charlie 934 37 +delta 972 37 +echo 1010 33 +foxtrot 1044 56 +golf 1101 38 +hotel 1140 39 +india 1180 36 +juliette 1217 39 +kilo 1257 33 +lima 1291 41 +mike 1333 33 +november 1367 38 +oscar 1406 40 +papa 1447 35 +quebec 1483 36 +romeo 1520 39 +sierra 1560 35 +tango 1596 40 +uniform 1637 45 +victor 1683 34 +whiskey 1718 33 +X-ray 1752 40 +yankee 1793 39 +zulu 1833 38 +1 1872 34 +2 1907 28 +3 1936 37 +4 1974 35 +5 2010 37 +6 2048 35 +7 2084 38 +8 2123 28 +9 2152 37 +0 2190 33 +