MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / stream_init_writer

Function stream_init_writer

modules/event_stream/stream_send.c:172–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172int stream_init_writer(void)
173{
174 int flags;
175
176 if (stream_pipe[0] != -1) {
177 close(stream_pipe[0]);
178 stream_pipe[0] = -1;
179 }
180
181 if (stream_reliable_mode) {
182 /* initilize indexes */
183 jrpc_id_index = my_pid() & USHRT_MAX;
184 jrpc_id_index |= rand() << sizeof(unsigned short);
185 }
186
187 /* Turn non-blocking mode on for sending*/
188 flags = fcntl(stream_pipe[1], F_GETFL);
189 if (flags == -1) {
190 LM_ERR("fcntl failed: %s\n", strerror(errno));
191 goto error;
192 }
193 if (fcntl(stream_pipe[1], F_SETFL, flags | O_NONBLOCK) == -1) {
194 LM_ERR("fcntl: set non-blocking failed: %s\n", strerror(errno));
195 goto error;
196 }
197
198 return 0;
199error:
200 close(stream_pipe[1]);
201 stream_pipe[1] = -1;
202 return -1;
203}
204
205static void jsonrpc_init_reader(void)
206{

Callers 1

child_initFunction · 0.85

Calls 1

my_pidFunction · 0.85

Tested by

no test coverage detected