Browse Source

Test

etomic
jl777 7 years ago
parent
commit
0762b303cf
  1. 3
      crypto777/nanosrc/core/global.c
  2. 7
      crypto777/nanosrc/core/sock.c
  3. 2
      crypto777/nanosrc/transports/ws/sws.c

3
crypto777/nanosrc/core/global.c

@ -1276,7 +1276,10 @@ static int nn_global_create_ep (int s, const char *addr, int bind)
tp = NULL;
}
if ( !tp ) // The protocol specified doesn't match any known protocol
{
printf("unknown protocol\n");
return -EPROTONOSUPPORT;
}
rc = nn_sock_add_ep (SELF.socks [s], tp, bind, addr); // Ask the socket to create the endpoint
return rc;
}

7
crypto777/nanosrc/core/sock.c

@ -477,6 +477,7 @@ struct nn_ep *nn_find_ep(struct nn_sock *self,int32_t eid,const char *addr,struc
int nn_sock_add_ep(struct nn_sock *self,struct nn_transport *transport,int32_t bind,const char *addr)
{
int rc,eid; struct nn_ep *ep;
printf("nn_sock_add_ep\n");
nn_ctx_enter (&self->ctx);
if ( (ep= nn_find_ep(self,0,addr,transport,bind)) == NULL ) // The endpoint doesn't exist
{
@ -484,16 +485,17 @@ int nn_sock_add_ep(struct nn_sock *self,struct nn_transport *transport,int32_t b
rc = nn_ep_init(ep,NN_SOCK_SRC_EP,self,self->eid,transport,bind,addr);
if ( nn_slow(rc < 0) )
{
printf("nn_sock_add_ep nn_ep_init rc.%d\n",rc);
nn_free(ep);
nn_ctx_leave(&self->ctx);
return rc;
}
nn_ep_start(ep);
PNACL_msg("ep sock.(%s) started %s://(%s) bind.%d\n",self->socket_name,transport->name,addr,bind);
printf("ep sock.(%s) started %s://(%s) bind.%d\n",self->socket_name,transport->name,addr,bind);
eid = self->eid++; // Increase the endpoint ID for the next endpoint
nn_list_insert(&self->eps,&ep->item,nn_list_end(&self->eps)); // Add to the list of active endpoints
nn_ctx_leave (&self->ctx);
} else PNACL_msg("self->sock.(%s) %p already has (%s)\n",self->socket_name,self->sockbase->sock,addr);
} else printf("self->sock.(%s) %p already has (%s)\n",self->socket_name,self->sockbase->sock,addr);
return(ep->eid);
}
@ -673,6 +675,7 @@ int nn_sock_add(struct nn_sock *self, struct nn_pipe *pipe)
{
int rc;
rc = self->sockbase->vfptr->add(self->sockbase,pipe);
printf("nn_sock_add rc.%d\n",rc);
if (nn_slow (rc >= 0)) {
nn_sock_stat_increment (self, NN_STAT_CURRENT_CONNECTIONS, 1);
}

2
crypto777/nanosrc/transports/ws/sws.c

@ -884,7 +884,7 @@ static void nn_sws_handler (struct nn_fsm *self, int src, int type,
int rc;
sws = nn_cont (self, struct nn_sws, fsm);
printf("sws src.%d type.%d state.%d\n",src,type,sws->state);
switch (sws->state) {
/******************************************************************************/

Loading…
Cancel
Save