Logo Search packages:      
Sourcecode: sofia-sip version File versions  Download package

tport_t* tport_alloc_secondary ( tport_primary_t pri,
int  socket,
int  accepted,
char const **  return_reason 

Allocate a secondary transport.

Create a secondary transport object. The new transport initally shares parameters structure with the original transport.

priprimary transport
socketsocket for transport accepted true if the socket was accepted from server socket
Pointer to the newly created transport, or NULL upon an error.
The socket is always closed upon error.

Definition at line 885 of file tport.c.

References su_close(), SU_DEBUG_7, su_home_clone(), su_now(), su_root_task(), and su_timer_create().

  tport_master_t *mr = pri->pri_master;
  tport_t *self;

  self = su_home_clone(mr->mr_home, pri->pri_vtable->vtp_secondary_size);

  if (self) {
    SU_DEBUG_7(("%s(%p): new secondary tport %p\n",
            __func__, (void *)pri, (void *)self));

    self->tp_master = mr;
    self->tp_pri = pri;
    self->tp_params = pri->pri_params;
    self->tp_accepted = accepted != 0;
    self->tp_reusable = pri->pri_primary->tp_reusable;

    self->tp_magic = pri->pri_primary->tp_magic;

    self->tp_addrinfo->ai_addr = (void *)self->tp_addr;

    self->tp_socket = socket;

    self->tp_timer = su_timer_create(su_root_task(mr->mr_root), 0);
    self->tp_stime = self->tp_ktime = self->tp_rtime = su_now();

    if (pri->pri_vtable->vtp_init_secondary &&
      pri->pri_vtable->vtp_init_secondary(self, socket, accepted,
                                  return_reason) < 0) {
      return NULL;

    /* Set IP TOS if it is set in primary */
  else {
    *return_reason = "malloc";

  return self;

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index