static int nn_inproc_connect (const char *addr, void *hint, struct nn_epbase **epbase) { struct nn_list_item *it; struct nn_cinproc *cinproc; struct nn_binproc *binproc; nn_mutex_lock (&self.sync); /* Insert the entry into the endpoint repository. */ cinproc = nn_cinproc_create (hint); nn_list_insert (&self.connected, &cinproc->item, nn_list_end (&self.connected)); /* During this process a pipe may be created. */ for (it = nn_list_begin (&self.bound); it != nn_list_end (&self.bound); it = nn_list_next (&self.bound, it)) { binproc = nn_cont (it, struct nn_binproc, item); if (strncmp (addr, nn_binproc_getaddr (binproc), NN_SOCKADDR_MAX) == 0) { /* Check whether the two sockets are compatible. */ if (!nn_epbase_ispeer (&cinproc->epbase, binproc->protocol)) break; ++binproc->connects; nn_cinproc_connect (cinproc, binproc); break; } } nn_assert (epbase); *epbase = &cinproc->epbase; nn_mutex_unlock (&self.sync); return 0; }
static int nn_inproc_connect (void *hint, struct nn_epbase **epbase) { return nn_cinproc_create (hint, epbase); }