void AddServerConf(char *address, int port, char *password) { struct servercstruct *slist, *stmp; stmp=malloc(sizeof(struct servercstruct)); LinkToList(stmp,slist,serverclist); slist->address=strdup(address); if(password!=NULL) slist->password=strdup(password); slist->port=port; slist->sinfo=GetNewSocket(server_action); SetIrcProtocol(slist->sinfo); slist->nexttry=0; if (slist->sinfo!=NULL) return; UnlinkListItem(slist,serverclist); free(slist->address); free(slist->password); free(slist); }
/** * Initialize the context, socket and connect to the bound address * @return * true when successful */ bool BoomStick::Initialize() { if (nullptr != mCtx) { return true; } mCtx = GetNewContext(); if (nullptr == mCtx) { LOG(WARNING) << "queue error " << zmq_strerror(zmq_errno()); return false; } mChamber = GetNewSocket(mCtx); // The memory in this pointer is managed by the context and should not be deleted if (nullptr == mChamber) { LOG(WARNING) << "queue error " << zmq_strerror(zmq_errno()); zctx_destroy(&mCtx); mCtx = nullptr; return false; } if (!ConnectToBinding(mChamber, mBinding)) { zctx_destroy(&mCtx); mChamber = nullptr; mCtx = nullptr; return false; } return true; }