Browse Source

builds pexe

release/v0.1
jl777 9 years ago
parent
commit
b2326f1713
  1. 2
      crypto777/crypto777.sources
  2. 2
      iguana/iguana.sources
  3. 6
      iguana/pangea777.h
  4. 3
      iguana/pangea_init.c
  5. 34
      iguana/pangea_network.c

2
crypto777/crypto777.sources

@ -42,5 +42,5 @@ NANOMSG = $(NANOMSG_CORE) $(NANOMSG_AIO) $(NANOMSG_UTILS) $(NANOMSG_DEVICES) $(N
JPEG_SRCS := ../crypto777/jpeg/jaricom.c ../crypto777/jpeg/jcapimin.c ../crypto777/jpeg/jcapistd.c ../crypto777/jpeg/jcarith.c ../crypto777/jpeg/jccoefct.c ../crypto777/jpeg/jccolor.c ../crypto777/jpeg/jcdctmgr.c ../crypto777/jpeg/jchuff.c ../crypto777/jpeg/jcinit.c ../crypto777/jpeg/jcmainct.c ../crypto777/jpeg/jcmarker.c ../crypto777/jpeg/jcmaster.c ../crypto777/jpeg/jcomapi.c ../crypto777/jpeg/jcparam.c ../crypto777/jpeg/jcprepct.c ../crypto777/jpeg/jcsample.c ../crypto777/jpeg/jctrans.c ../crypto777/jpeg/jdapimin.c ../crypto777/jpeg/jdapistd.c ../crypto777/jpeg/jdarith.c ../crypto777/jpeg/jdatadst.c ../crypto777/jpeg/jdatasrc.c ../crypto777/jpeg/jdcoefct.c ../crypto777/jpeg/jdcolor.c ../crypto777/jpeg/jddctmgr.c ../crypto777/jpeg/jdhuff.c ../crypto777/jpeg/jdinput.c ../crypto777/jpeg/jdmainct.c ../crypto777/jpeg/jdmarker.c ../crypto777/jpeg/jdmaster.c ../crypto777/jpeg/jdmerge.c ../crypto777/jpeg/jdpostct.c ../crypto777/jpeg/jdsample.c ../crypto777/jpeg/jdtrans.c ../crypto777/jpeg/jerror.c ../crypto777/jpeg/jfdctflt.c ../crypto777/jpeg/jfdctfst.c ../crypto777/jpeg/jfdctint.c ../crypto777/jpeg/jidctflt.c ../crypto777/jpeg/jidctfst.c ../crypto777/jpeg/jidctint.c ../crypto777/jpeg/jquant1.c ../crypto777/jpeg/jquant2.c ../crypto777/jpeg/jutils.c ../crypto777/jpeg/jmemmgr.c ../crypto777/jpeg/jmemnobs.c JPEG_SRCS := ../crypto777/jpeg/jaricom.c ../crypto777/jpeg/jcapimin.c ../crypto777/jpeg/jcapistd.c ../crypto777/jpeg/jcarith.c ../crypto777/jpeg/jccoefct.c ../crypto777/jpeg/jccolor.c ../crypto777/jpeg/jcdctmgr.c ../crypto777/jpeg/jchuff.c ../crypto777/jpeg/jcinit.c ../crypto777/jpeg/jcmainct.c ../crypto777/jpeg/jcmarker.c ../crypto777/jpeg/jcmaster.c ../crypto777/jpeg/jcomapi.c ../crypto777/jpeg/jcparam.c ../crypto777/jpeg/jcprepct.c ../crypto777/jpeg/jcsample.c ../crypto777/jpeg/jctrans.c ../crypto777/jpeg/jdapimin.c ../crypto777/jpeg/jdapistd.c ../crypto777/jpeg/jdarith.c ../crypto777/jpeg/jdatadst.c ../crypto777/jpeg/jdatasrc.c ../crypto777/jpeg/jdcoefct.c ../crypto777/jpeg/jdcolor.c ../crypto777/jpeg/jddctmgr.c ../crypto777/jpeg/jdhuff.c ../crypto777/jpeg/jdinput.c ../crypto777/jpeg/jdmainct.c ../crypto777/jpeg/jdmarker.c ../crypto777/jpeg/jdmaster.c ../crypto777/jpeg/jdmerge.c ../crypto777/jpeg/jdpostct.c ../crypto777/jpeg/jdsample.c ../crypto777/jpeg/jdtrans.c ../crypto777/jpeg/jerror.c ../crypto777/jpeg/jfdctflt.c ../crypto777/jpeg/jfdctfst.c ../crypto777/jpeg/jfdctint.c ../crypto777/jpeg/jidctflt.c ../crypto777/jpeg/jidctfst.c ../crypto777/jpeg/jidctint.c ../crypto777/jpeg/jquant1.c ../crypto777/jpeg/jquant2.c ../crypto777/jpeg/jutils.c ../crypto777/jpeg/jmemmgr.c ../crypto777/jpeg/jmemnobs.c
CRYPTO777_SRCS := ../crypto777/tweetnacl.c ../crypto777/cJSON.c ../crypto777/iguana_utils.c ../crypto777/OS_nonportable.c ../crypto777/curve25519-donna.c ../crypto777/inet.c ../crypto777/OS_portable.c ../crypto777/curve25519.c ../crypto777/libgfshare.c ../crypto777/OS_time.c ../crypto777/hmac_sha512.c ../crypto777/ramcoder.c ../crypto777/SaM.c ../crypto777/iguana_OS.c ../crypto777/iguana_serdes.c $(JPEG_SRCS) # $(NANOMSG) CRYPTO777_SRCS := ../crypto777/tweetnacl.c ../crypto777/bitcoind_RPC.c ../crypto777/cJSON.c ../crypto777/iguana_utils.c ../crypto777/OS_nonportable.c ../crypto777/curve25519-donna.c ../crypto777/inet.c ../crypto777/OS_portable.c ../crypto777/curve25519.c ../crypto777/libgfshare.c ../crypto777/OS_time.c ../crypto777/hmac_sha512.c ../crypto777/ramcoder.c ../crypto777/SaM.c ../crypto777/iguana_OS.c ../crypto777/iguana_serdes.c $(JPEG_SRCS) # $(NANOMSG)

2
iguana/iguana.sources

@ -1,3 +1,3 @@
#iguana_html.c #iguana_html.c
SOURCES := SuperNET.c pangea_api.c pangea_fsm.c pangea_network.c pangea_init.c poker.c ramchain_api.c iguana_tx.c iguana_wallet.c iguana_pubkeys.c iguana_recv.c iguana_bundles.c iguana_msg.c iguana_rpc.c iguana777.c iguana_chains.c iguana_peers.c iguana_accept.c iguana_bitmap.c iguana_init.c iguana_ramchain.c iguana_blocks.c iguana_json.c main.c SOURCES := SuperNET.c pangea_api.c pangea_funds.c cards777.c pangea_fsm.c pangea_network.c pangea_init.c poker.c ramchain_api.c iguana_tx.c iguana_wallet.c iguana_pubkeys.c iguana_recv.c iguana_bundles.c iguana_msg.c iguana_rpc.c iguana777.c iguana_chains.c iguana_peers.c iguana_accept.c iguana_bitmap.c iguana_init.c iguana_ramchain.c iguana_blocks.c iguana_json.c main.c

6
iguana/pangea777.h

@ -94,7 +94,8 @@ struct pangea_info
int32_t myslot,myind,numactive,buyinvouts[CARDS777_MAXPLAYERS]; uint64_t buyinamounts[CARDS777_MAXPLAYERS]; int32_t myslot,myind,numactive,buyinvouts[CARDS777_MAXPLAYERS]; uint64_t buyinamounts[CARDS777_MAXPLAYERS];
char buyintxids[CARDS777_MAXPLAYERS][128],coinaddrs[CARDS777_MAXPLAYERS][67],btcpubkeys[CARDS777_MAXPLAYERS][67]; char buyintxids[CARDS777_MAXPLAYERS][128],coinaddrs[CARDS777_MAXPLAYERS][67],btcpubkeys[CARDS777_MAXPLAYERS][67];
struct pangea_thread *tp; struct cards777_privdata *priv; struct cards777_pubdata *dp; struct pangea_thread *tp; struct cards777_privdata *priv; struct cards777_pubdata *dp;
} *TABLES[100]; };
extern struct pangea_info *TABLES[100];
//./BitcoinDarkd SuperNET '{"agent":"InstantDEX","method":"orderbook","exchange":"active","base":"NXT","rel":"BTC"}' //./BitcoinDarkd SuperNET '{"agent":"InstantDEX","method":"orderbook","exchange":"active","base":"NXT","rel":"BTC"}'
// ./SNapi "{\"agent\":\"InstantDEX\",\"method\":\"orderbook\",\"exchange\":\"pangea\",\"base\":\"NXT\"}" // ./SNapi "{\"agent\":\"InstantDEX\",\"method\":\"orderbook\",\"exchange\":\"pangea\",\"base\":\"NXT\"}"
@ -124,7 +125,8 @@ struct pangeanet777_server
struct pangea_thread struct pangea_thread
{ {
union pangeanet777 hn; uint64_t nxt64bits; int32_t threadid,ishost,M,N,numcards; union pangeanet777 hn; uint64_t nxt64bits; int32_t threadid,ishost,M,N,numcards;
} *THREADS[_PANGEA_MAXTHREADS]; };
extern struct pangea_thread *THREADS[_PANGEA_MAXTHREADS];
int32_t SuperNET_copybits(int32_t reverse,uint8_t *dest,uint8_t *src,int32_t len); int32_t SuperNET_copybits(int32_t reverse,uint8_t *dest,uint8_t *src,int32_t len);

3
iguana/pangea_init.c

@ -15,6 +15,9 @@
#include "pangea777.h" #include "pangea777.h"
struct pangea_info *TABLES[100];
struct pangea_thread *THREADS[_PANGEA_MAXTHREADS];
void pangea_buyins(uint32_t *minbuyinp,uint32_t *maxbuyinp) void pangea_buyins(uint32_t *minbuyinp,uint32_t *maxbuyinp)
{ {
if ( *minbuyinp == 0 && *maxbuyinp == 0 ) if ( *minbuyinp == 0 && *maxbuyinp == 0 )

34
iguana/pangea_network.c

@ -73,12 +73,12 @@ void pangeanet777_processmsg(uint64_t *destbitsp,bits256 *senderpubp,queue_t *Q,
int32_t pangeanet777_idle(union pangeanet777 *hn) int32_t pangeanet777_idle(union pangeanet777 *hn)
{ {
int32_t len,slot,sock,n = 0; bits256 senderpub,mypriv,mypub; uint64_t destbits; uint8_t *msg; int32_t len=0,slot,n = 0; bits256 senderpub,mypriv,mypub; uint64_t destbits; uint8_t *msg=0;
long extra = sizeof(bits256)+sizeof(uint64_t); //long extra = sizeof(bits256)+sizeof(uint64_t);
if ( (slot= hn->client->H.slot) != 0 ) if ( (slot= hn->client->H.slot) != 0 )
{ {
mypriv = hn->client->H.privkey, mypub = hn->client->H.pubkey; mypriv = hn->client->H.privkey, mypub = hn->client->H.pubkey;
if ( (sock= hn->client->subsock) >= 0 && (len= nn_recv(sock,&msg,NN_MSG,0)) > extra ) /*if ( (sock= hn->client->subsock) >= 0 && (len= nn_recv(sock,&msg,NN_MSG,0)) > extra )
{ {
SuperNET_copybits(1,msg,(void *)&destbits,sizeof(uint64_t)); SuperNET_copybits(1,msg,(void *)&destbits,sizeof(uint64_t));
//printf("client got pub len.%d\n",len); //printf("client got pub len.%d\n",len);
@ -86,7 +86,7 @@ int32_t pangeanet777_idle(union pangeanet777 *hn)
pangeanet777_processmsg(&destbits,&senderpub,&hn->client->H.Q,mypriv,mypub,msg,len,0), n++; pangeanet777_processmsg(&destbits,&senderpub,&hn->client->H.Q,mypriv,mypub,msg,len,0), n++;
nn_freemsg(msg); nn_freemsg(msg);
} else if ( hn->client->H.pollfunc != 0 ) } else if ( hn->client->H.pollfunc != 0 )
(*hn->client->H.pollfunc)(hn); (*hn->client->H.pollfunc)(hn);*/
} }
else else
{ {
@ -95,7 +95,7 @@ int32_t pangeanet777_idle(union pangeanet777 *hn)
for (slot=1; slot<hn->server->num; slot++) for (slot=1; slot<hn->server->num; slot++)
{ {
//printf("check ind.%d %.0f\n",ind,milliseconds()); //printf("check ind.%d %.0f\n",ind,milliseconds());
if ( (sock= hn->server->clients[slot].pmsock) >= 0 && (len= nn_recv(sock,&msg,NN_MSG,0)) > extra ) //f ( (sock= hn->server->clients[slot].pmsock) >= 0 && (len= nn_recv(sock,&msg,NN_MSG,0)) > extra )
{ {
//printf("server got pm[%d] %d\n",slot,len); //printf("server got pm[%d] %d\n",slot,len);
SuperNET_copybits(1,msg,(void *)&destbits,sizeof(uint64_t)); SuperNET_copybits(1,msg,(void *)&destbits,sizeof(uint64_t));
@ -106,7 +106,7 @@ int32_t pangeanet777_idle(union pangeanet777 *hn)
} }
printf("pangeanet777_idle: do the send here\n"); printf("pangeanet777_idle: do the send here\n");
//pangeanet777_send(hn->server->pubsock,msg,len); //pangeanet777_send(hn->server->pubsock,msg,len);
nn_freemsg(msg); //nn_freemsg(msg);
} }
} }
if ( hn->server->H.pollfunc != 0 ) if ( hn->server->H.pollfunc != 0 )
@ -142,8 +142,8 @@ int32_t pangeanet777_register(struct pangeanet777_server *srv,bits256 clientpub,
{ {
slot = (int32_t)(((long)ptr - (long)srv->clients) / sizeof(*srv->clients)); slot = (int32_t)(((long)ptr - (long)srv->clients) / sizeof(*srv->clients));
//printf("pangea_register: deregister slot.%d\n",slot); //printf("pangea_register: deregister slot.%d\n",slot);
if ( ptr->pmsock >= 0 ) //if ( ptr->pmsock >= 0 )
nn_shutdown(ptr->pmsock,0); // nn_shutdown(ptr->pmsock,0);
memset(ptr,0,sizeof(*ptr)); memset(ptr,0,sizeof(*ptr));
ptr->pmsock = -1; ptr->pmsock = -1;
srv->num--; srv->num--;
@ -199,7 +199,7 @@ struct pangeanet777_client *pangeanet777_client(bits256 privkey,bits256 pubkey,c
sprintf(endbuf2,"%s%u",endbuf,port); sprintf(endbuf2,"%s%u",endbuf,port);
//ptr->subsock = nn_createsocket(endbuf2,0,"NN_SUB",NN_SUB,0,10,100); //ptr->subsock = nn_createsocket(endbuf2,0,"NN_SUB",NN_SUB,0,10,100);
printf("SUB %d from (%s) port.%d\n",ptr->subsock,endbuf2,port); printf("SUB %d from (%s) port.%d\n",ptr->subsock,endbuf2,port);
nn_setsockopt(ptr->subsock,NN_SUB,NN_SUB_SUBSCRIBE,"",0); //nn_setsockopt(ptr->subsock,NN_SUB,NN_SUB_SUBSCRIBE,"",0);
//sprintf(endbuf2,"%s%u",endbuf,port); //sprintf(endbuf2,"%s%u",endbuf,port);
//ptr->pushsock = nn_createsocket(endbuf2,0,"NN_PUSH",NN_PUSH,0,10,1); //ptr->pushsock = nn_createsocket(endbuf2,0,"NN_PUSH",NN_PUSH,0,10,1);
//printf("PUSH %d to (%s)\n",ptr->pushsock,endbuf2); //printf("PUSH %d to (%s)\n",ptr->pushsock,endbuf2);
@ -209,12 +209,12 @@ struct pangeanet777_client *pangeanet777_client(bits256 privkey,bits256 pubkey,c
void pangeanet777_freeclient(struct pangeanet777_client *client) void pangeanet777_freeclient(struct pangeanet777_client *client)
{ {
client->H.done = 1; client->H.done = 1;
if ( client->subsock >= 0 ) //if ( client->subsock >= 0 )
nn_shutdown(client->subsock,0); // nn_shutdown(client->subsock,0);
//if ( client->pushsock >= 0 ) //if ( client->pushsock >= 0 )
// nn_shutdown(client->pushsock,0); // nn_shutdown(client->pushsock,0);
if ( client->my.pmsock >= 0 ) //if ( client->my.pmsock >= 0 )
nn_shutdown(client->my.pmsock,0); // nn_shutdown(client->my.pmsock,0);
} }
void pangeanet777_freeserver(struct pangeanet777_server *srv) void pangeanet777_freeserver(struct pangeanet777_server *srv)
@ -223,12 +223,12 @@ void pangeanet777_freeserver(struct pangeanet777_server *srv)
srv->H.done = 1; srv->H.done = 1;
//if ( srv->pullsock >= 0 ) //if ( srv->pullsock >= 0 )
// nn_shutdown(srv->pullsock,0); // nn_shutdown(srv->pullsock,0);
if ( srv->pubsock >= 0 ) //if ( srv->pubsock >= 0 )
nn_shutdown(srv->pubsock,0); // nn_shutdown(srv->pubsock,0);
for (ind=1; ind<srv->max; ind++) for (ind=1; ind<srv->max; ind++)
{ {
if ( srv->clients[ind].pmsock >= 0 ) // if ( srv->clients[ind].pmsock >= 0 )
nn_shutdown(srv->clients[ind].pmsock,0); // nn_shutdown(srv->clients[ind].pmsock,0);
} }
} }

Loading…
Cancel
Save