本文整理汇总了C++中Daemon::addr方法的典型用法代码示例。如果您正苦于以下问题:C++ Daemon::addr方法的具体用法?C++ Daemon::addr怎么用?C++ Daemon::addr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Daemon
的用法示例。
在下文中一共展示了Daemon::addr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setPPstyle
//.........这里部分代码省略.........
const char * s;
dashAttributes.rewind();
while ((s = dashAttributes.next())) {
projList.AppendArg(s);
}
}
}
if( projList.Count() > 0 ) {
char **attr_list = projList.GetStringArray();
query->setDesiredAttrs(attr_list);
deleteStringArray(attr_list);
}
// if diagnose was requested, just print the query ad
if (diagnose) {
ClassAd queryAd;
// print diagnostic information about inferred internal state
setMode ((Mode) 0, 0, NULL);
setType (NULL, 0, NULL);
setPPstyle ((ppOption) 0, 0, DEFAULT);
printf ("----------\n");
q = query->getQueryAd (queryAd);
fPrintAd (stdout, queryAd);
printf ("----------\n");
fprintf (stderr, "Result of making query ad was: %d\n", q);
exit (1);
}
// Address (host:port) is taken from requested pool, if given.
char* addr = (NULL != pool) ? pool->addr() : NULL;
Daemon* requested_daemon = pool;
// If we're in "direct" mode, then we attempt to locate the daemon
// associated with the requested subsystem (here encoded by value of mode)
// In this case the host:port of pool (if given) denotes which
// pool is being consulted
if( direct ) {
Daemon *d = NULL;
switch( mode ) {
case MODE_MASTER_NORMAL:
d = new Daemon( DT_MASTER, direct, addr );
break;
case MODE_STARTD_NORMAL:
case MODE_STARTD_AVAIL:
case MODE_STARTD_RUN:
case MODE_STARTD_COD:
d = new Daemon( DT_STARTD, direct, addr );
break;
#ifdef HAVE_EXT_POSTGRESQL
case MODE_QUILL_NORMAL:
d = new Daemon( DT_QUILL, direct, addr );
break;
#endif /* HAVE_EXT_POSTGRESQL */
case MODE_SCHEDD_NORMAL:
case MODE_SCHEDD_SUBMITTORS:
d = new Daemon( DT_SCHEDD, direct, addr );
break;
case MODE_NEGOTIATOR_NORMAL:
d = new Daemon( DT_NEGOTIATOR, direct, addr );
break;
示例2: main
int main( int argc, char *argv[] )
{
char *pool=0;
char *name=0;
char *address=0;
char *optional_config=0;
int output_mode = -1;
daemon_t dtype = DT_NONE;
int i;
ExtArray<MyString> worklist_name;
ExtArray<int> worklist_number;
int worklist_count = 0;
Daemon * daemon = NULL;
myDistro->Init( argc, argv );
config();
for( i=1; i<argc; i++ ) {
if(!strncmp(argv[i],"-help",strlen(argv[i]))) {
usage(argv[0]);
exit(0);
} else if(!strncmp(argv[i],"-quiet",strlen(argv[i]))) {
if(output_mode == -1) {
output_mode = 0;
} else {
fprintf(stderr,"ERROR: only one output mode may be specified.\n\n");
usage(argv[0]);
exit(1);
}
} else if(!strncmp(argv[i],"-table",strlen(argv[i]))) {
if(output_mode == -1) {
output_mode = 10;
} else {
fprintf(stderr,"ERROR: only one output mode may be specified.\n\n");
usage(argv[0]);
exit(1);
}
} else if(!strncmp(argv[i],"-verbose",strlen(argv[i]))) {
if(output_mode == -1) {
output_mode = 2;
} else {
fprintf(stderr,"ERROR: only one output mode may be specified.\n\n");
usage(argv[0]);
exit(1);
}
} else if(!strncmp(argv[i],"-config",strlen(argv[i]))) {
i++;
if(!argv[i]) {
fprintf(stderr,"ERROR: -config requires an argument.\n\n");
usage(argv[0]);
exit(1);
}
optional_config = argv[i];
} else if(!strncmp(argv[i],"-pool",strlen(argv[i]))) {
i++;
if(!argv[i]) {
fprintf(stderr,"ERROR: -pool requires an argument.\n\n");
usage(argv[0]);
exit(1);
}
if(address) {
fprintf(stderr,"ERROR: -address cannot be used with -pool or -name.\n\n");
usage(argv[0]);
exit(1);
}
pool = argv[i];
} else if(!strncmp(argv[i],"-name",strlen(argv[i]))) {
i++;
if(!argv[i]) {
fprintf(stderr,"ERROR: -name requires an argument.\n\n");
usage(argv[0]);
exit(1);
}
if(address) {
fprintf(stderr,"ERROR: -address cannot be used with -pool or -name.\n\n");
usage(argv[0]);
exit(1);
}
name = argv[i];
} else if(!strncmp(argv[i],"-type",strlen(argv[i]))) {
i++;
if(!argv[i]) {
fprintf(stderr,"ERROR: -type requires an argument.\n\n");
usage(argv[0]);
exit(1);
}
dtype = stringToDaemonType(argv[i]);
if( dtype == DT_NONE) {
fprintf(stderr,"ERROR: unrecognized daemon type: %s\n\n", argv[i]);
usage(argv[0]);
exit(1);
}
} else if(!strncmp(argv[i],"-address",strlen(argv[i]))) {
i++;
if(!argv[i]) {
fprintf(stderr,"ERROR: -address requires an argument.\n\n");
usage(argv[0]);
exit(1);
}
//.........这里部分代码省略.........
示例3: main
int main( int argc, char *argv[] )
{
char *machine_name = 0;
char *log_name = 0;
char *pool=0;
int i;
daemon_t type = DT_MASTER;
myDistro->Init( argc, argv );
config();
for( i=1; i<argc; i++ ) {
if(!strcmp(argv[i],"-help")) {
usage(argv[0]);
exit(0);
} else if(!strcmp(argv[i],"-pool")) {
i++;
if(!argv[i]) {
fprintf(stderr,"-pool requires an argument.\n\n");
usage(argv[0]);
exit(1);
}
pool = argv[i];
} else if(!strcmp(argv[i],"-version")) {
version();
exit(0);
} else if(!strcmp(argv[i],"-debug")) {
dprintf_set_tool_debug("TOOL", 0);
} else if(argv[i][0]=='-') {
type = stringToDaemonType(&argv[i][1]);
if( type == DT_NONE || type == DT_DAGMAN) {
usage(argv[0]);
exit(1);
}
} else if(argv[i][0]!='-') {
if(!machine_name) {
machine_name = argv[i];
} else if(!log_name) {
log_name = argv[i];
} else {
fprintf(stderr,"Extra argument: %s\n\n",argv[i]);
usage(argv[0]);
exit(1);
}
} else {
usage(argv[0]);
exit(1);
}
}
if( !machine_name || !log_name ) {
usage(argv[0]);
exit(1);
}
Daemon *daemon;
ReliSock *sock;
if (pool) {
DCCollector col( pool );
if( ! col.addr() ) {
fprintf( stderr, "Error: %s\n", col.error() );
exit(1);
}
daemon = new Daemon( type, machine_name, col.addr() );
} else {
daemon = new Daemon( type, machine_name );
}
dprintf(D_FULLDEBUG,"Locating daemon process on %s...\n",machine_name);
if(!daemon->locate()) {
fprintf(stderr,"Couldn't locate daemon on %s: %s\n",machine_name,daemon->error());
exit(1);
}
dprintf(D_FULLDEBUG,"Daemon %s is %s\n",daemon->hostname(),daemon->addr());
sock = (ReliSock*)daemon->startCommand( DC_FETCH_LOG, Sock::reli_sock);
if(!sock) {
fprintf(stderr,"couldn't connect to daemon %s at %s\n",daemon->hostname(),daemon->addr());
return 1;
}
int commandType = DC_FETCH_LOG_TYPE_PLAIN;
if ((strcmp(log_name, "HISTORY") == 0) || (strcmp(log_name, "STARTD_HISTORY") == 0)) {
commandType = DC_FETCH_LOG_TYPE_HISTORY;
}
if ((strcmp(log_name, "STARTD.PER_JOB_HISTORY_DIR") == 0) || (strcmp(log_name, "STARTD.PER_JOB_HISTORY_DIR") == 0)) {
commandType = DC_FETCH_LOG_TYPE_HISTORY_DIR;
}
sock->put( commandType );
sock->put( log_name );
sock->end_of_message();
//.........这里部分代码省略.........