51 #if defined(HAVE_SIGNAL_H) && defined(HAVE_SIGSET)
53 # define SIGSET(sig,func) ::sigset(sig,func)
54 #elif defined(HAVE_SIGNAL_H)
56 # define SIGSET(sig,func) ::signal(sig,func)
60 # include <omniORB4/internal/orbOptions.h>
66 int main(
int argc,
char** argv)
74 int originalArgc =argc;
75 char** originalArgv =
new char*[originalArgc];
76 for(
int i=0; i<originalArgc; ++i)
77 originalArgv[i]=strdup(argv[i]);
81 omni::orbOptions::singleton().extractInitOptions(argc,argv);
89 using namespace OmniEvents;
93 const char* endPointNoListen =NULL;
95 const char* logDir =NULL;
96 const char* factoryName =
"EventChannelFactory";
100 while ((c =
getopt(argc,argv,
"O:a:p:l:P:N:dft:vVh")) != EOF)
107 case 'a': endPointNoListen=
optarg;
110 case 'p': port=atoi(
optarg);
113 cerr<<
"\nError: port must be a positive integer"<<endl;
125 case 'N': factoryName=
optarg;
128 case 'd': cerr<<
"Option '-d' is deprecated. Use '-f' instead."<<endl;
139 case 'v': verbose=
true;
146 default :
usage(argc,argv);
158 initialState=logfile.
parse();
160 if(port && port!=initialState->child(
"ecf")->attrLong(
"port"))
163 "Error: Option '-p "<<port<<
"' conflicts with value '"<<
164 initialState->
child(
"ecf")->
attrLong(
"port")<<
"'\n stored in"
166 " Either delete the file to clear the database, or do not use the"
167 " '-p' option."<<endl;
170 if(endPointNoListen &&
string(endPointNoListen)!=
171 initialState->child(
"ecf")->attrString(
"endPointNoListen"))
174 "Error: Option '-a "<<endPointNoListen<<
"' conflicts with value '"<<
175 initialState->child(
"ecf")->attrString(
"endPointNoListen")<<
"'\n"
177 " Either delete the file to clear the database, or do not use the"
178 " '-a' option."<<endl;
186 "Error: backup file '" << logfile.
backupFilename() <<
"' exists.\n"
188 " to recover the server's state, or delete it to create a new\n"
189 " database file." << endl;
195 initialState=logfile.
bootstrap(port?port:11169,endPointNoListen);
198 string endPoint2=initialState->child(
"ecf")->attrString(
"endPointNoListen");
208 sprintf(endPoint,
"giop:::%d",port);
209 if(endPoint2.empty())
211 const char* opts[][2] ={ {
"endPoint",endPoint}, {0,0} };
212 Orb::inst().
_orb=CORBA::ORB_init(originalArgc,originalArgv,
"omniORB4",opts);
216 const char* opts[][2] ={
217 {
"endPoint",endPoint},
218 {
"endPointNoListen",endPoint2.c_str()},
220 Orb::inst().
_orb=CORBA::ORB_init(originalArgc,originalArgv,
"omniORB4",opts);
224 argv[1] = strdup(
"-ORBpoa_iiop_port");
225 argv[2] =
new char[32 + 1];
226 sprintf(argv[2],
"%d", port);
231 PortableServer::POAManager_var pman;
249 omniEvents::EventChannelFactory_var factory( logfile.
factory()->_this() );
260 DB(1,
"Starting omniEvents on port "<<port)
261 if(!endPoint2.empty())
262 DB(1,
"Alternate endPoint "<<endPoint2.c_str())
263 CORBA::String_var iorstr =
276 SIGSET(SIGPIPE, SIG_IGN);
287 DB(1,
"Shutdown requested.")
295 catch (CORBA::SystemException& ex) {
298 catch (CORBA::Exception& ex) {
299 DB(0,
"CORBA exception: "<<ex._name())
319 omniORB::traceLevel=(omniORB::traceLevel+5)%45;
320 DB(0,
"TRACE LEVEL BUMPED TO "<<omniORB::traceLevel<<
" BY SIGNAL "<<signum)