@@ -804,7 +804,14 @@ void CentralWorker::_workerKeyInsertReq(LoaderMsg const& inMsg, std::unique_ptr<
804
804
protoReply.SerializeToString (&(strElem.element ));
805
805
strElem.appendToData (msgData);
806
806
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
+ }
808
815
} else {
809
816
lck.unlock ();
810
817
// Find the target range in the list and send the request there
@@ -842,7 +849,14 @@ void CentralWorker::_forwardKeyInsertRequest(NetworkAddress const& targetAddr, L
842
849
StringElement strElem;
843
850
protoData->SerializeToString (&(strElem.element ));
844
851
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
+ }
846
860
}
847
861
848
862
@@ -909,7 +923,14 @@ void CentralWorker::_workerKeyInfoReq(LoaderMsg const& inMsg, std::unique_ptr<pr
909
923
protoReply.SerializeToString (&(strElem.element ));
910
924
strElem.appendToData (msgData);
911
925
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
+ }
913
934
} else {
914
935
// Find the target range in the list and send the request there
915
936
auto targetWorker = _wWorkerList->findWorkerForKey (key);
@@ -986,7 +1007,14 @@ void CentralWorker::_sendWorkerKeysInfo(NetworkAddress const& nAddr, uint64_t ms
986
1007
LOGS (_log, LOG_LVL_INFO, " sending WorkerKeysInfo name=" << _ourId <<
987
1008
" mapsize=" << protoWKI->mapsize () << " recentAdds=" << protoWKI->recentadds () <<
988
1009
" 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
+ }
990
1018
}
991
1019
992
1020
@@ -1035,7 +1063,14 @@ void CentralWorker::_forwardKeyInfoRequest(WWorkerListItem::Ptr const& target, L
1035
1063
strElem.appendToData (msgData);
1036
1064
1037
1065
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
+ }
1039
1074
}
1040
1075
1041
1076
@@ -1053,7 +1088,13 @@ void CentralWorker::_registerWithMaster() {
1053
1088
protoBuf.SerializeToString (&(strElem.element ));
1054
1089
strElem.appendToData (msgData);
1055
1090
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
+ }
1057
1098
}
1058
1099
1059
1100
@@ -1063,7 +1104,12 @@ void CentralWorker::testSendBadMessage() {
1063
1104
LOGS (_log, LOG_LVL_INFO, " testSendBadMessage msg=" << msg);
1064
1105
BufferUdp msgData (128 );
1065
1106
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
+ }
1067
1113
}
1068
1114
1069
1115
0 commit comments