jl777 7 years ago
parent
commit
323b8361a3
  1. 9
      iguana/exchanges/LP_commands.c
  2. 2
      iguana/exchanges/LP_include.h
  3. 6
      iguana/exchanges/LP_network.c

9
iguana/exchanges/LP_commands.c

@ -233,20 +233,23 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
}
else if ( strcmp(method,"getendpoint") == 0 )
{
char endpoint[64];
nanomsg_wsendpoint(1,endpoint,LP_myipaddr,7781);
retjson = cJSON_CreateObject();
if ( IPC_ENDPOINT >= 0 )
{
jaddstr(retjson,"error","IPC endpoint already exists");
jaddstr(retjson,"endpoint",LP_IPC_ENDPOINT);
jaddstr(retjson,"endpoint",endpoint);
}
else
{
if ( (IPC_ENDPOINT= nn_socket(AF_SP,NN_PUB)) >= 0 )
{
if ( nn_bind(IPC_ENDPOINT,"tcp://*:7781") >= 0 )
if ( nn_bind(IPC_ENDPOINT,endpoint) >= 0 )
{
jaddstr(retjson,"result","success");
jaddstr(retjson,"endpoint",LP_IPC_ENDPOINT);
nanomsg_wsendpoint(0,endpoint,LP_myipaddr,7781);
jaddstr(retjson,"endpoint",endpoint);
} else jaddstr(retjson,"error","couldnt connect to IPC_ENDPOINT");
} else jaddstr(retjson,"error","couldnt get NN_PUB socket");
}

2
iguana/exchanges/LP_include.h

@ -39,8 +39,6 @@ voind dontprintf(char *formatstr,...) {}
#define LP_BARTERDEX_VERSION 1
#define LP_MAGICBITS 1
#define LP_IPC_ENDPOINT "tcp://127.0.0.1:7781"
#define LP_DONT_IMPORTPRIVKEY
#ifdef FROM_JS

6
iguana/exchanges/LP_network.c

@ -102,6 +102,12 @@ char *nanomsg_transportname(int32_t bindflag,char *str,char *ipaddr,uint16_t por
return(str);
}
char *nanomsg_wsendpoint(int32_t bindflag,char *str,char *ipaddr,uint16_t port)
{
sprintf(str,"ws://%s:%u",bindflag == 0 ? ipaddr : "*",port+10);
return(str);
}
/*char *nanomsg_transportname2(int32_t bindflag,char *str,char *ipaddr,uint16_t port)
{
sprintf(str,"ws://%s:%u",bindflag == 0 ? ipaddr : "*",port+10);

Loading…
Cancel
Save