MCPcopy Create free account
hub / github.com/apache/trafficserver / init

Method init

src/mgmt/rpc/server/IPCSocketServer.cc:139–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139std::error_code
140IPCSocketServer::init()
141{
142 // Need to run some validations on the pathname to avoid issue. Normally this would not be an issue, but some tests may fail on
143 // this.
144 if (_conf.sockPathName.empty() || _conf.sockPathName.size() > sizeof _serverAddr.sun_path) {
145 Dbg(dbg_ctl, "Invalid unix path name, check the size.");
146 return std::make_error_code(static_cast<std::errc>(ENAMETOOLONG));
147 }
148
149 std::error_code ec; // Flag possible errors.
150
151 if (this->create_socket(ec); ec) {
152 return ec;
153 }
154
155 Dbg(dbg_ctl, "Using %s as socket path.", _conf.sockPathName.c_str());
156 _serverAddr.sun_family = AF_UNIX;
157 std::strncpy(_serverAddr.sun_path, _conf.sockPathName.c_str(), sizeof(_serverAddr.sun_path) - 1);
158
159 if (this->bind(ec); ec) {
160 this->close();
161 return ec;
162 }
163
164 if (this->listen(ec); ec) {
165 this->close();
166 return ec;
167 }
168
169 return ec;
170}
171
172bool
173IPCSocketServer::poll_for_new_client(std::chrono::milliseconds timeout) const

Callers 1

RPCServerMethod · 0.45

Calls 8

create_socketMethod · 0.95
bindMethod · 0.95
closeMethod · 0.95
listenMethod · 0.95
make_error_codeFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected