@@ -804,7 +804,14 @@ void CentralWorker::_workerKeyInsertReq(LoaderMsg const& inMsg, std::unique_ptr<
804804 protoReply.SerializeToString (&(strElem.element ));
805805 strElem.appendToData (msgData);
806806 LOGS (_log, LOG_LVL_INFO, " sending complete " << key << " to " << nAddr << " from " << _ourId);
807- sendBufferTo (nAddr.ip , nAddr.port , msgData);
807+ try {
808+ sendBufferTo (nAddr.ip , nAddr.port , msgData);
809+ } catch (boost::system::system_error e) {
810+ LOGS (_log, LOG_LVL_ERROR, " CentralWorker::_workerKeyInsertReq boost system_error=" << e.what () <<
811+ " msg=" << inMsg);
812+ exit (-1 ); // TODO:&&& The correct course of action is unclear and requires thought,
813+ // so just blow up so it's unmistakable something bad happened for now.
814+ }
808815 } else {
809816 lck.unlock ();
810817 // Find the target range in the list and send the request there
@@ -842,7 +849,14 @@ void CentralWorker::_forwardKeyInsertRequest(NetworkAddress const& targetAddr, L
842849 StringElement strElem;
843850 protoData->SerializeToString (&(strElem.element ));
844851 strElem.appendToData (msgData);
845- sendBufferTo (targetAddr.ip , targetAddr.port , msgData);
852+ try {
853+ sendBufferTo (targetAddr.ip , targetAddr.port , msgData);
854+ } catch (boost::system::system_error e) {
855+ LOGS (_log, LOG_LVL_ERROR, " CentralWorker::_forwardKeyInsertRequest boost system_error=" << e.what () <<
856+ " tAddr=" << targetAddr << " inMsg=" << inMsg);
857+ exit (-1 ); // TODO:&&& The correct course of action is unclear and requires thought,
858+ // so just blow up so it's unmistakable something bad happened for now.
859+ }
846860}
847861
848862
@@ -909,7 +923,14 @@ void CentralWorker::_workerKeyInfoReq(LoaderMsg const& inMsg, std::unique_ptr<pr
909923 protoReply.SerializeToString (&(strElem.element ));
910924 strElem.appendToData (msgData);
911925 LOGS (_log, LOG_LVL_INFO, " sending key lookup " << key << " to " << nAddr << " from " << _ourId);
912- sendBufferTo (nAddr.ip , nAddr.port , msgData);
926+ try {
927+ sendBufferTo (nAddr.ip , nAddr.port , msgData);
928+ }catch (boost::system::system_error e) {
929+ LOGS (_log, LOG_LVL_ERROR, " CentralWorker::_workerKeyInfoReq boost system_error=" << e.what () <<
930+ " inMsg=" << inMsg);
931+ exit (-1 ); // TODO:&&& The correct course of action is unclear and requires thought,
932+ // so just blow up so it's unmistakable something bad happened for now.
933+ }
913934 } else {
914935 // Find the target range in the list and send the request there
915936 auto targetWorker = _wWorkerList->findWorkerForKey (key);
@@ -986,7 +1007,14 @@ void CentralWorker::_sendWorkerKeysInfo(NetworkAddress const& nAddr, uint64_t ms
9861007 LOGS (_log, LOG_LVL_INFO, " sending WorkerKeysInfo name=" << _ourId <<
9871008 " mapsize=" << protoWKI->mapsize () << " recentAdds=" << protoWKI->recentadds () <<
9881009 " to " << nAddr);
989- sendBufferTo (nAddr.ip , nAddr.port , msgData);
1010+ try {
1011+ sendBufferTo (nAddr.ip , nAddr.port , msgData);
1012+ } catch (boost::system::system_error e) {
1013+ LOGS (_log, LOG_LVL_ERROR, " CentralWorker::_sendWorkerKeysInfo boost system_error=" << e.what () <<
1014+ " nAddr=" << nAddr << " msgId=" << msgId);
1015+ exit (-1 ); // TODO:&&& The correct course of action is unclear and requires thought,
1016+ // so just blow up so it's unmistakable something bad happened for now.
1017+ }
9901018}
9911019
9921020
@@ -1035,7 +1063,14 @@ void CentralWorker::_forwardKeyInfoRequest(WWorkerListItem::Ptr const& target, L
10351063 strElem.appendToData (msgData);
10361064
10371065 auto nAddr = target->getUdpAddress ();
1038- sendBufferTo (nAddr.ip , nAddr.port , msgData);
1066+ try {
1067+ sendBufferTo (nAddr.ip , nAddr.port , msgData);
1068+ } catch (boost::system::system_error e) {
1069+ LOGS (_log, LOG_LVL_ERROR, " CentralWorker::_forwardKeyInfoRequest boost system_error=" << e.what () <<
1070+ " target=" << target << " inMsg=" << inMsg);
1071+ exit (-1 ); // TODO:&&& The correct course of action is unclear and requires thought,
1072+ // so just blow up so it's unmistakable something bad happened for now.
1073+ }
10391074}
10401075
10411076
@@ -1053,7 +1088,13 @@ void CentralWorker::_registerWithMaster() {
10531088 protoBuf.SerializeToString (&(strElem.element ));
10541089 strElem.appendToData (msgData);
10551090
1056- sendBufferTo (getMasterHostName (), getMasterPort (), msgData);
1091+ try {
1092+ sendBufferTo (getMasterHostName (), getMasterPort (), msgData);
1093+ } catch (boost::system::system_error e) {
1094+ LOGS (_log, LOG_LVL_ERROR, " CentralWorker::_registerWithMaster boost system_error=" << e.what ());
1095+ exit (-1 ); // TODO:&&& The correct course of action is unclear and requires thought,
1096+ // so just blow up so it's unmistakable something bad happened for now.
1097+ }
10571098}
10581099
10591100
@@ -1063,7 +1104,12 @@ void CentralWorker::testSendBadMessage() {
10631104 LOGS (_log, LOG_LVL_INFO, " testSendBadMessage msg=" << msg);
10641105 BufferUdp msgData (128 );
10651106 msg.appendToData (msgData);
1066- sendBufferTo (getMasterHostName (), getMasterPort (), msgData);
1107+ try {
1108+ sendBufferTo (getMasterHostName (), getMasterPort (), msgData);
1109+ } catch (boost::system::system_error e) {
1110+ LOGS (_log, LOG_LVL_ERROR, " CentralWorker::testSendBadMessage boost system_error=" << e.what ());
1111+ throw e; // This would not be the expected error, re-throw so it is noticed.
1112+ }
10671113}
10681114
10691115
0 commit comments