Browse Source

Test

etomic
jl777 7 years ago
parent
commit
ee03fa567e
  1. 76
      crypto777/nanosrc/aio/usock_posix.c
  2. 4
      crypto777/nanosrc/core/global.c
  3. 4
      crypto777/nanosrc/core/sock.c
  4. 4
      crypto777/nanosrc/nn_config.h
  5. 2
      crypto777/nanosrc/transports/utils/tcpmux.c
  6. 2
      crypto777/nanosrc/transports/ws/sws.c

76
crypto777/nanosrc/aio/usock_posix.c

@ -167,7 +167,7 @@ int nn_usock_start (struct nn_usock *self, int domain, int type, int protocol)
s = socket (domain, type, protocol); s = socket (domain, type, protocol);
if (nn_slow (s < 0)) if (nn_slow (s < 0))
return -errno; return -errno;
//PNACL_msg("got socket s.%d\n",s); //printf("got socket s.%d\n",s);
nn_usock_init_from_fd (self, s); nn_usock_init_from_fd (self, s);
/* Start the state machine. */ /* Start the state machine. */
@ -286,14 +286,14 @@ int nn_usock_bind (struct nn_usock *self, const struct sockaddr *addr,
/* Allow re-using the address. */ /* Allow re-using the address. */
opt = 1; opt = 1;
PNACL_msg("call setsockopt %d SOL_SOCKET.%d SO_REUSEADDR.%d in nn_usock_bind\n",self->s,SOL_SOCKET,SO_REUSEADDR); printf("call setsockopt %d SOL_SOCKET.%d SO_REUSEADDR.%d in nn_usock_bind\n",self->s,SOL_SOCKET,SO_REUSEADDR);
rc = setsockopt (self->s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof (opt)); rc = setsockopt (self->s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof (opt));
PNACL_msg("called setsockopt in nn_usock_bind returns %d\n",rc); printf("called setsockopt in nn_usock_bind returns %d\n",rc);
// ignore SO_REUSEADDR failures // ignore SO_REUSEADDR failures
//errno_assert (rc == 0); //errno_assert (rc == 0);
rc = bind (self->s, addr, (socklen_t) addrlen); rc = bind (self->s, addr, (socklen_t) addrlen);
PNACL_msg("usock.%d -> bind rc.%d errno.%d %s\n",self->s,rc,errno,nn_strerror(errno)); printf("usock.%d -> bind rc.%d errno.%d %s\n",self->s,rc,errno,nn_strerror(errno));
if (nn_slow (rc != 0)) if (nn_slow (rc != 0))
return -errno; return -errno;
@ -309,7 +309,7 @@ int nn_usock_listen (struct nn_usock *self, int backlog)
/* Start listening for incoming connections. */ /* Start listening for incoming connections. */
rc = listen (self->s, backlog); rc = listen (self->s, backlog);
//PNACL_msg("usock.%d -> listen rc.%d errno.%d %s\n",self->s,rc,errno,nn_strerror(errno)); printf("usock.%d -> listen rc.%d errno.%d %s\n",self->s,rc,errno,nn_strerror(errno));
if (nn_slow (rc != 0)) if (nn_slow (rc != 0))
return -errno; return -errno;
@ -336,7 +336,7 @@ void nn_usock_accept (struct nn_usock *self, struct nn_usock *listener)
#else #else
s = accept (listener->s, NULL, NULL); s = accept (listener->s, NULL, NULL);
#endif #endif
//PNACL_msg("usock.%d -> accept errno.%d s.%d %s\n",self->s,errno,s,nn_strerror(errno)); printf("usock.%d -> accept errno.%d s.%d %s\n",self->s,errno,s,nn_strerror(errno));
/* Immediate success. */ /* Immediate success. */
if (nn_fast (s >= 0)) { if (nn_fast (s >= 0)) {
@ -369,7 +369,7 @@ void nn_usock_accept (struct nn_usock *self, struct nn_usock *listener)
and allow processing other events in the meantime */ and allow processing other events in the meantime */
if (nn_slow (errno != EAGAIN && errno != EWOULDBLOCK && errno != ECONNABORTED && errno != listener->errnum)) if (nn_slow (errno != EAGAIN && errno != EWOULDBLOCK && errno != ECONNABORTED && errno != listener->errnum))
{ {
PNACL_msg("listen errno.%d\n",errno); printf("listen errno.%d\n",errno);
listener->errnum = errno; listener->errnum = errno;
listener->state = NN_USOCK_STATE_ACCEPTING_ERROR; listener->state = NN_USOCK_STATE_ACCEPTING_ERROR;
nn_fsm_raise (&listener->fsm, nn_fsm_raise (&listener->fsm,
@ -396,7 +396,7 @@ void nn_usock_connect (struct nn_usock *self, const struct sockaddr *addr,
/* Do the connect itself. */ /* Do the connect itself. */
rc = connect(self->s,addr,(socklen_t)addrlen); rc = connect(self->s,addr,(socklen_t)addrlen);
//PNACL_msg("usock.%d <- connect (%llx) rc.%d errno.%d %s\n",self->s,*(long long *)addr,rc,errno,nn_strerror(errno)); printf("usock.%d <- connect (%llx) rc.%d errno.%d %s\n",self->s,*(long long *)addr,rc,errno,nn_strerror(errno));
/* Immediate success. */ /* Immediate success. */
if ( nn_fast(rc == 0) ) if ( nn_fast(rc == 0) )
{ {
@ -407,7 +407,7 @@ void nn_usock_connect (struct nn_usock *self, const struct sockaddr *addr,
if ( nn_slow(errno != EINPROGRESS) ) if ( nn_slow(errno != EINPROGRESS) )
{ {
self->errnum = errno; self->errnum = errno;
PNACL_msg("error.%d not EINPROGRESS\n",errno); printf("error.%d not EINPROGRESS\n",errno);
nn_fsm_action (&self->fsm, NN_USOCK_ACTION_ERROR); nn_fsm_action (&self->fsm, NN_USOCK_ACTION_ERROR);
return; return;
} }
@ -436,13 +436,13 @@ void nn_usock_send (struct nn_usock *self, const struct nn_iovec *iov,
self->out.iov [out].iov_base = iov [i].iov_base; self->out.iov [out].iov_base = iov [i].iov_base;
self->out.iov [out].iov_len = iov [i].iov_len; self->out.iov [out].iov_len = iov [i].iov_len;
out++; out++;
//PNACL_msg("{%d} ",(int)iov [i].iov_len); printf("{%d} ",(int)iov [i].iov_len);
} }
//PNACL_msg("iov[%d]\n",out);
self->out.hdr.msg_iovlen = out; self->out.hdr.msg_iovlen = out;
/* Try to send the data immediately. */ /* Try to send the data immediately. */
rc = nn_usock_send_raw (self, &self->out.hdr); rc = nn_usock_send_raw (self, &self->out.hdr);
printf("iov[%d] nn_usock_send_raw -> rc.%d\n",out,rc);
/* Success. */ /* Success. */
if (nn_fast (rc == 0)) { if (nn_fast (rc == 0)) {
@ -475,17 +475,17 @@ void nn_usock_recv (struct nn_usock *self, void *buf, size_t len, int *fd)
rc = nn_usock_recv_raw (self, buf, &nbytes); rc = nn_usock_recv_raw (self, buf, &nbytes);
if (nn_slow (rc < 0)) { if (nn_slow (rc < 0)) {
errnum_assert (rc == -ECONNRESET, -rc); errnum_assert (rc == -ECONNRESET, -rc);
//PNACL_msg("rc.%d vs ECONNRESET\n",rc,ECONNRESET); //printf("rc.%d vs ECONNRESET\n",rc,ECONNRESET);
nn_fsm_action (&self->fsm, NN_USOCK_ACTION_ERROR); nn_fsm_action (&self->fsm, NN_USOCK_ACTION_ERROR);
return; return;
} }
//int i; //int i;
//for (i=0; i<16&&i<nbytes; i++) //for (i=0; i<16&&i<nbytes; i++)
// PNACL_msg("%02x ",((uint8_t *)buf)[i]); // printf("%02x ",((uint8_t *)buf)[i]);
//PNACL_msg("nn_usock_recv nbytes.%d\n",(int)nbytes); //printf("nn_usock_recv nbytes.%d\n",(int)nbytes);
/* Success. */ /* Success. */
if (nn_fast (nbytes == len)) { if (nn_fast (nbytes == len)) {
//PNACL_msg("raise NN_USOCK_RECEIVED\n"); //printf("raise NN_USOCK_RECEIVED\n");
nn_fsm_raise (&self->fsm, &self->event_received, NN_USOCK_RECEIVED); nn_fsm_raise (&self->fsm, &self->event_received, NN_USOCK_RECEIVED);
return; return;
} }
@ -1024,19 +1024,19 @@ int32_t nn_getiovec_size(uint8_t *buf,int32_t maxlen,struct msghdr *hdr)
if ( nn_slow(iov->iov_len == NN_MSG) ) if ( nn_slow(iov->iov_len == NN_MSG) )
{ {
errno = EINVAL; errno = EINVAL;
PNACL_msg("ERROR: iov->iov_len == NN_MSG\n"); printf("ERROR: iov->iov_len == NN_MSG\n");
return(-1); return(-1);
} }
if ( nn_slow(!iov->iov_base && iov->iov_len) ) if ( nn_slow(!iov->iov_base && iov->iov_len) )
{ {
errno = EFAULT; errno = EFAULT;
PNACL_msg("ERROR: !iov->iov_base && iov->iov_len\n"); printf("ERROR: !iov->iov_base && iov->iov_len\n");
return(-1); return(-1);
} }
if ( maxlen > 0 && nn_slow(size + iov->iov_len > maxlen) ) if ( maxlen > 0 && nn_slow(size + iov->iov_len > maxlen) )
{ {
errno = EINVAL; errno = EINVAL;
PNACL_msg("ERROR: sz.%d + iov->iov_len.%d < maxlen.%d\n",(int32_t)size,(int32_t)iov->iov_len,maxlen); printf("ERROR: sz.%d + iov->iov_len.%d < maxlen.%d\n",(int32_t)size,(int32_t)iov->iov_len,maxlen);
return(-1); return(-1);
} }
if ( iov->iov_len > 0 ) if ( iov->iov_len > 0 )
@ -1057,7 +1057,7 @@ ssize_t mysendmsg(int32_t usock,struct msghdr *hdr,int32_t flags)
clen = hdr->msg_controllen; clen = hdr->msg_controllen;
if ( hdr->msg_control == 0 ) if ( hdr->msg_control == 0 )
clen = 0; clen = 0;
nn_assert(clen == 0); // no supporty control messagies nn_assert(clen == 0); // no support control messagies
if ( veclen > sizeof(_buf) ) // - clen - 5) ) if ( veclen > sizeof(_buf) ) // - clen - 5) )
buf = malloc(veclen);// + clen + 5); buf = malloc(veclen);// + clen + 5);
else buf = _buf; else buf = _buf;
@ -1072,10 +1072,10 @@ ssize_t mysendmsg(int32_t usock,struct msghdr *hdr,int32_t flags)
if ( nn_getiovec_size(&buf[offset],veclen,hdr) == veclen ) if ( nn_getiovec_size(&buf[offset],veclen,hdr) == veclen )
{ {
nbytes = send(usock,buf,offset + veclen,0); nbytes = send(usock,buf,offset + veclen,0);
//PNACL_msg(">>>>>>>>> send.[%d %d %d %d] (n.%d v.%d c.%d)-> usock.%d nbytes.%d\n",buf[offset],buf[offset+1],buf[offset+2],buf[offset+3],(int32_t)offset+veclen,veclen,clen,usock,(int32_t)nbytes); printf(">>>>>>>>> send.[%d %d %d %d] (n.%d v.%d c.%d)-> usock.%d nbytes.%d\n",buf[offset],buf[offset+1],buf[offset+2],buf[offset+3],(int32_t)offset+veclen,veclen,clen,usock,(int32_t)nbytes);
if ( nbytes != offset + veclen ) if ( nbytes != offset + veclen )
{ {
//PNACL_msg("nbytes.%d != offset.%d veclen.%d errno.%d usock.%d\n",(int32_t)nbytes,(int32_t)offset,veclen,errno,usock); printf("nbytes.%d != offset.%d veclen.%d errno.%d usock.%d\n",(int32_t)nbytes,(int32_t)offset,veclen,errno,usock);
} }
if ( nbytes >= offset ) if ( nbytes >= offset )
nbytes -= offset; nbytes -= offset;
@ -1083,19 +1083,19 @@ ssize_t mysendmsg(int32_t usock,struct msghdr *hdr,int32_t flags)
else else
{ {
err = -errno; err = -errno;
PNACL_msg("mysendmsg: unexpected nn_getiovec_size error %d\n",err); printf("mysendmsg: unexpected nn_getiovec_size error %d\n",err);
} }
if ( buf != _buf ) if ( buf != _buf )
free(buf); free(buf);
if ( err != 0 ) if ( err != 0 )
{ {
PNACL_msg("nn_usock_send_raw errno.%d err.%d\n",errno,err); printf("nn_usock_send_raw errno.%d err.%d\n",errno,err);
return(-errno); return(-errno);
} }
} }
else else
{ {
PNACL_msg("nn_usock_send_raw errno.%d invalid iovec size\n",errno); printf("nn_usock_send_raw errno.%d invalid iovec size\n",errno);
return(-errno); return(-errno);
} }
return(nbytes); return(nbytes);
@ -1107,32 +1107,32 @@ ssize_t myrecvmsg(int32_t usock,struct msghdr *hdr,int32_t flags,int32_t len)
iov = hdr->msg_iov; iov = hdr->msg_iov;
/*if ( (n= (int32_t)recv(usock,lens,sizeof(lens),0)) != sizeof(lens) ) /*if ( (n= (int32_t)recv(usock,lens,sizeof(lens),0)) != sizeof(lens) )
{ {
PNACL_msg("error getting veclen/clen n.%d vs %d from usock.%d\n",n,(int32_t)sizeof(lens),usock); printf("error getting veclen/clen n.%d vs %d from usock.%d\n",n,(int32_t)sizeof(lens),usock);
return(0); return(0);
} else PNACL_msg("GOT %d bytes from usock.%d\n",n,usock); } else printf("GOT %d bytes from usock.%d\n",n,usock);
offset = 0; offset = 0;
veclen = lens[offset++]; veclen = lens[offset++];
veclen |= ((int32_t)lens[offset++] << 8); veclen |= ((int32_t)lens[offset++] << 8);
veclen |= ((int32_t)lens[offset++] << 16); veclen |= ((int32_t)lens[offset++] << 16);
clen = lens[offset++]; clen = lens[offset++];
clen |= ((int32_t)lens[offset++] << 8); clen |= ((int32_t)lens[offset++] << 8);
PNACL_msg("veclen.%d clen.%d waiting in usock.%d\n",veclen,clen,usock); printf("veclen.%d clen.%d waiting in usock.%d\n",veclen,clen,usock);
if ( clen > 0 ) if ( clen > 0 )
{ {
if ( (cbytes= (int32_t)recv(usock,hdr->msg_control,clen,0)) != clen ) if ( (cbytes= (int32_t)recv(usock,hdr->msg_control,clen,0)) != clen )
{ {
PNACL_msg("myrecvmsg: unexpected cbytes.%d vs clen.%d\n",cbytes,clen); printf("myrecvmsg: unexpected cbytes.%d vs clen.%d\n",cbytes,clen);
} }
} else cbytes = 0;*/ } else cbytes = 0;*/
hdr->msg_controllen = 0; hdr->msg_controllen = 0;
if ( (nbytes= (int32_t)recv(usock,iov->iov_base,len,0)) != len ) if ( (nbytes= (int32_t)recv(usock,iov->iov_base,len,0)) != len )
{ {
//PNACL_msg("myrecvmsg: partial nbytes.%d vs veclen.%d\n",(int32_t)nbytes,len); //printf("myrecvmsg: partial nbytes.%d vs veclen.%d\n",(int32_t)nbytes,len);
} }
//PNACL_msg("GOT nbytes.%d of len.%d from usock.%d\n",(int32_t)nbytes,len,usock); //printf("GOT nbytes.%d of len.%d from usock.%d\n",(int32_t)nbytes,len,usock);
if ( 0 && nbytes > 0 ) if ( 0 && nbytes > 0 )
{ {
PNACL_msg("got nbytes.%d from usock.%d [%d %d %d %d]\n",(int32_t)nbytes,usock,((uint8_t *)iov->iov_base)[0],((uint8_t *)iov->iov_base)[1],((uint8_t *)iov->iov_base)[2],((uint8_t *)iov->iov_base)[3]); printf("got nbytes.%d from usock.%d [%d %d %d %d]\n",(int32_t)nbytes,usock,((uint8_t *)iov->iov_base)[0],((uint8_t *)iov->iov_base)[1],((uint8_t *)iov->iov_base)[2],((uint8_t *)iov->iov_base)[3]);
} }
return(nbytes); return(nbytes);
} }
@ -1147,7 +1147,7 @@ static int nn_usock_send_raw (struct nn_usock *self, struct msghdr *hdr)
nbytes = sendmsg(self->s,hdr,MSG_NOSIGNAL); nbytes = sendmsg(self->s,hdr,MSG_NOSIGNAL);
#else #else
nbytes = sendmsg(self->s,hdr,0); nbytes = sendmsg(self->s,hdr,0);
//PNACL_msg("sendmsg nbytes.%d\n",(int32_t)nbytes); printf("nn_usock_send_raw nbytes.%d\n",(int32_t)nbytes);
#endif #endif
#endif #endif
/* Handle errors. */ /* Handle errors. */
@ -1202,13 +1202,13 @@ int32_t nn_process_cmsg(struct nn_usock *self,struct msghdr *hdr)
memcpy(&retval,(int32_t *)CMSG_DATA(cmsg),sizeof(int32_t)); memcpy(&retval,(int32_t *)CMSG_DATA(cmsg),sizeof(int32_t));
if ( self->in.pfd ) if ( self->in.pfd )
{ {
PNACL_msg("CMSG set self->in.pfd (%d)\n",retval); printf("CMSG set self->in.pfd (%d)\n",retval);
*self->in.pfd = retval; *self->in.pfd = retval;
self->in.pfd = NULL; self->in.pfd = NULL;
} }
else else
{ {
PNACL_msg("CMSG nn_closefd(%d)\n",retval); printf("CMSG nn_closefd(%d)\n",retval);
nn_closefd(retval); nn_closefd(retval);
} }
break; break;
@ -1260,7 +1260,7 @@ static int nn_usock_recv_raw(struct nn_usock *self, void *buf, size_t *len)
if (!length) if (!length)
return 0; return 0;
} }
#ifdef NN_USE_MYMSG #if NN_USE_MYMSG
usebuf = (length >= NN_USOCK_BATCH_SIZE); usebuf = (length >= NN_USOCK_BATCH_SIZE);
#else #else
usebuf = (length >= NN_USOCK_BATCH_SIZE); usebuf = (length >= NN_USOCK_BATCH_SIZE);
@ -1289,7 +1289,7 @@ static int nn_usock_recv_raw(struct nn_usock *self, void *buf, size_t *len)
#if NN_USE_MYMSG #if NN_USE_MYMSG
nbytes = myrecvmsg(self->s,&hdr,0,(int32_t)iov.iov_len); nbytes = myrecvmsg(self->s,&hdr,0,(int32_t)iov.iov_len);
//PNACL_msg("got nbytes.%d from recvmsg errno.%d %s\n",(int32_t)nbytes,errno,nn_strerror(errno)); printf("got nbytes.%d from recvmsg errno.%d %s\n",(int32_t)nbytes,errno,nn_strerror(errno));
#else #else
nbytes = recvmsg (self->s, &hdr, 0); nbytes = recvmsg (self->s, &hdr, 0);
#endif #endif
@ -1301,7 +1301,7 @@ static int nn_usock_recv_raw(struct nn_usock *self, void *buf, size_t *len)
nbytes = 0; nbytes = 0;
else else
{ {
PNACL_msg("recvraw errno.%d %s\n",errno,nn_strerror(errno)); printf("recvraw errno.%d %s\n",errno,nn_strerror(errno));
// If the peer closes the connection, return ECONNRESET // If the peer closes the connection, return ECONNRESET
errno_assert(errno == ECONNRESET || errno == ENOTCONN || errno == ECONNREFUSED || errno == ETIMEDOUT || errno == EHOSTUNREACH errno_assert(errno == ECONNRESET || errno == ENOTCONN || errno == ECONNREFUSED || errno == ETIMEDOUT || errno == EHOSTUNREACH
#if NN_USE_MYMSG #if NN_USE_MYMSG
@ -1313,7 +1313,7 @@ static int nn_usock_recv_raw(struct nn_usock *self, void *buf, size_t *len)
} }
} else if ( hdr.msg_controllen > 0 ) } else if ( hdr.msg_controllen > 0 )
nn_process_cmsg(self,&hdr); nn_process_cmsg(self,&hdr);
//PNACL_msg("nbytes.%d length.%d *len %d\n",(int)nbytes,(int)length,(int)*len); printf("nbytes.%d length.%d *len %d\n",(int)nbytes,(int)length,(int)*len);
// If the data were received directly into the place we can return straight away // If the data were received directly into the place we can return straight away
if ( usebuf != 0 ) if ( usebuf != 0 )

4
crypto777/nanosrc/core/global.c

@ -668,7 +668,7 @@ int32_t nn_recv(int32_t s,void *buf,size_t len,int32_t flags)
return nn_recvmsg(s,&hdr,flags); return nn_recvmsg(s,&hdr,flags);
} }
#ifdef NN_USE_MYMSG #if NN_USE_MYMSG
int32_t nn_sendmsg(int32_t s,const struct nn_msghdr *msghdr,int32_t flags) int32_t nn_sendmsg(int32_t s,const struct nn_msghdr *msghdr,int32_t flags)
{ {
@ -1253,7 +1253,7 @@ static int nn_global_create_ep (int s, const char *addr, int bind)
return -EINVAL; return -EINVAL;
protosz = delim - addr; protosz = delim - addr;
addr += protosz + 3; addr += protosz + 3;
#ifdef NN_USE_MYMSG #if NN_USE_MYMSG
if ( strncmp("inproc",proto,strlen("inproc")) != 0 && strncmp("ipc",proto,strlen("ipc")) != 0 && strncmp("tcp",proto,strlen("tcp")) && strncmp("ws",proto,strlen("ws")) != 0 ) if ( strncmp("inproc",proto,strlen("inproc")) != 0 && strncmp("ipc",proto,strlen("ipc")) != 0 && strncmp("tcp",proto,strlen("tcp")) && strncmp("ws",proto,strlen("ws")) != 0 )
{ {
PNACL_msg("only ipc, inproc, ws and tcp transport is supported\n"); PNACL_msg("only ipc, inproc, ws and tcp transport is supported\n");

4
crypto777/nanosrc/core/sock.c

@ -548,6 +548,7 @@ int nn_sock_send(struct nn_sock *self, struct nn_msg *msg, int flags)
/* Try to send the message in a non-blocking way. */ /* Try to send the message in a non-blocking way. */
rc = self->sockbase->vfptr->send (self->sockbase, msg); rc = self->sockbase->vfptr->send (self->sockbase, msg);
printf("sockbase send rc.%d\n",rc);
if (nn_fast (rc == 0)) { if (nn_fast (rc == 0)) {
nn_ctx_leave (&self->ctx); nn_ctx_leave (&self->ctx);
return 0; return 0;
@ -560,8 +561,7 @@ int nn_sock_send(struct nn_sock *self, struct nn_msg *msg, int flags)
return rc; return rc;
} }
/* If the message cannot be sent at the moment and the send call // If the message cannot be sent at the moment and the send call is non-blocking, return immediately.
is non-blocking, return immediately. */
if (nn_fast (flags & NN_DONTWAIT)) { if (nn_fast (flags & NN_DONTWAIT)) {
nn_ctx_leave (&self->ctx); nn_ctx_leave (&self->ctx);
return -EAGAIN; return -EAGAIN;

4
crypto777/nanosrc/nn_config.h

@ -58,10 +58,10 @@
performance optimal make sure that this value is larger than network MTU. */ performance optimal make sure that this value is larger than network MTU. */
#define NN_USOCK_BATCH_SIZE (2048) #define NN_USOCK_BATCH_SIZE (2048)
//#define NN_USOCK_BATCH_SIZE (_NN_USOCK_BATCH_SIZE - 5 - 256 - 16) // adjust for veclen/clen + sizeof(ctrl) //#define NN_USOCK_BATCH_SIZE (_NN_USOCK_BATCH_SIZE - 5 - 256 - 16) // adjust for veclen/clen + sizeof(ctrl)
#define NN_USE_MYMSG 1 #define NN_USE_MYMSG 0
#if defined __PNACL || defined __APPLE__ #if defined __PNACL || defined __APPLE__
#define NN_USE_MYMSG 1 #define NN_USE_MYMSG 0
#endif #endif
#define nn_errstr() nn_strerror(nn_errno()) #define nn_errstr() nn_strerror(nn_errno())

2
crypto777/nanosrc/transports/utils/tcpmux.c

@ -83,7 +83,7 @@ int tcpmux_accept (int s)
memset (&hdr, 0, sizeof (hdr)); memset (&hdr, 0, sizeof (hdr));
hdr.msg_iov = &iov; hdr.msg_iov = &iov;
hdr.msg_iovlen = 1; hdr.msg_iovlen = 1;
#ifndef NN_USE_MYMSG #if !NN_USE_MYMSG
unsigned char buf [256]; unsigned char buf [256];
hdr.msg_control = buf; hdr.msg_control = buf;
hdr.msg_controllen = sizeof (buf); hdr.msg_controllen = sizeof (buf);

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

@ -370,7 +370,7 @@ static int nn_sws_send (struct nn_pipebase *self, struct nn_msg *msg)
struct nn_cmsghdr *cmsg; struct nn_cmsghdr *cmsg;
struct nn_msghdr msghdr; struct nn_msghdr msghdr;
uint8_t rand_mask [NN_SWS_FRAME_SIZE_MASK]; uint8_t rand_mask [NN_SWS_FRAME_SIZE_MASK];
printf("nn_sws_send\n");
sws = nn_cont (self, struct nn_sws, pipebase); sws = nn_cont (self, struct nn_sws, pipebase);
nn_assert_state (sws, NN_SWS_STATE_ACTIVE); nn_assert_state (sws, NN_SWS_STATE_ACTIVE);

Loading…
Cancel
Save