MCPcopy Create free account
hub / github.com/Tencent/Hardcoder / init

Method init

libapp2sys/src/main/cpp/client.h:440–480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

438 }
439
440 int init(const char *remote, const int port, const char *local, IC2JavaCallback *cb) {
441 if (m_pClientEngine) {
442 pdbg("ClientInit client already inited, remote:%s, port:%d, local:%s, cb:%d",
443 m_remote.c_str(), m_port, m_local.c_str(), TOINT(cb));
444 m_pC2JavaCallback->callback(CALLBACK_TYPE_STATUS, 0, 0, ERR_CLIENT_ALREADY_INIT, 0, 0, NULL, 0);
445 return 0;
446 }
447
448 m_pC2JavaCallback = cb;
449
450 if(remote == NULL){
451 m_remote = "";
452 } else {
453 char *c1 = getSocketName(remote, "|");
454 if(c1 == NULL){
455 m_remote = "";
456 } else {
457 m_remote = c1;
458 }
459 delete[] c1;
460 }
461
462 m_local = (local == NULL ? "" : local);
463 m_port = port;
464
465 char *version = getVersion(remote, "|");
466
467 if (version == NULL) {
468 HEADER_VERSION = HEADER_PROTOCAL_VERSION;;
469 } else {
470 HEADER_VERSION = atoi(version);
471 if (HEADER_VERSION <= 0) {
472 HEADER_VERSION = HEADER_PROTOCAL_VERSION;
473 }
474 }
475
476 pdbg("init m_remote:%s, HEADER_VERSION:%d", m_remote.c_str(), HEADER_VERSION);
477 tryStartEngine();
478 delete[] version;
479 return 0;
480 }
481
482};
483

Callers

nothing calls this directly

Calls 3

getSocketNameFunction · 0.85
getVersionFunction · 0.85
callbackMethod · 0.80

Tested by

no test coverage detected