@@ -1627,6 +1627,12 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
16271627 }
16281628 }
16291629
1630+ std::string sem_str = args.GetArg (" -socketevents" , DEFAULT_SOCKETEVENTS);
1631+ ::g_socket_events_mode = SEMFromString (sem_str);
1632+ if (::g_socket_events_mode == SocketEventsMode::Unknown) {
1633+ return InitError (strprintf (_ (" Invalid -socketevents ('%s') specified. Only these modes are supported: %s" ), sem_str, GetSupportedSocketEventsStr ()));
1634+ }
1635+
16301636 assert (!node.banman );
16311637 node.banman = std::make_unique<BanMan>(gArgs .GetDataDirNet () / " banlist" , &uiInterface, args.GetIntArg (" -bantime" , DEFAULT_MISBEHAVING_BANTIME));
16321638 assert (!node.connman );
@@ -2405,6 +2411,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
24052411 connOptions.m_added_nodes = args.GetArgs (" -addnode" );
24062412 connOptions.nMaxOutboundLimit = *opt_max_upload;
24072413 connOptions.m_peer_connect_timeout = peer_connect_timeout;
2414+ connOptions.socketEventsMode = ::g_socket_events_mode;
24082415
24092416 // Port to bind to if `-bind=addr` is provided without a `:port` suffix.
24102417 const uint16_t default_bind_port =
@@ -2512,14 +2519,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
25122519 }
25132520 }
25142521
2515- std::string sem_str = args.GetArg (" -socketevents" , DEFAULT_SOCKETEVENTS);
2516- const auto sem = SEMFromString (sem_str);
2517- if (sem == SocketEventsMode::Unknown) {
2518- return InitError (strprintf (_ (" Invalid -socketevents ('%s') specified. Only these modes are supported: %s" ), sem_str, GetSupportedSocketEventsStr ()));
2519- }
2520- connOptions.socketEventsMode = sem;
2521- ::g_socket_events_mode = sem;
2522-
25232522 const std::string& i2psam_arg = args.GetArg (" -i2psam" , " " );
25242523 if (!i2psam_arg.empty ()) {
25252524 const std::optional<CService> addr{Lookup (i2psam_arg, 7656 , fNameLookup )};
0 commit comments