This commit is contained in:
Gabriel mermelstein 2024-10-14 10:36:49 +03:00
parent 0b5e20b00a
commit d1f09c1c60
No known key found for this signature in database
GPG Key ID: 82B8134785FEAE0D
2 changed files with 1 additions and 33 deletions

View File

@ -55,9 +55,7 @@ package wakuv2
// resp must be set != NULL in case interest on retrieving data from the callback // resp must be set != NULL in case interest on retrieving data from the callback
static void callback(int ret, char* msg, size_t len, void* resp) { static void callback(int ret, char* msg, size_t len, void* resp) {
printf("---------- GABRIEL calling callback 1 ----\n");
if (resp != NULL) { if (resp != NULL) {
printf("---------- GABRIEL calling callback 2 ----\n");
Resp* m = (Resp*) resp; Resp* m = (Resp*) resp;
m->ret = ret; m->ret = ret;
m->msg = msg; m->msg = msg;
@ -67,7 +65,6 @@ package wakuv2
#define WAKU_CALL(call) \ #define WAKU_CALL(call) \
do { \ do { \
printf("---------- GABRIEL calling WAKU_CALL 1 ----\n"); \
int ret = call; \ int ret = call; \
if (ret != 0) { \ if (ret != 0) { \
printf("Failed the call to: %s. Returned code: %d\n", #call, ret); \ printf("Failed the call to: %s. Returned code: %d\n", #call, ret); \
@ -1875,17 +1872,12 @@ func (self *Waku) WakuStart() error {
defer C.freeResp(resp) defer C.freeResp(resp)
fmt.Println("------------ GABRIEL called wakuStart")
C.cGoWakuStart(self.wakuCtx, resp) C.cGoWakuStart(self.wakuCtx, resp)
fmt.Println("------------ GABRIEL wakuStart 2")
if C.getRet(resp) == C.RET_OK { if C.getRet(resp) == C.RET_OK {
fmt.Println("------------ GABRIEL wakuStart received RET_OK")
return nil return nil
} }
fmt.Println("------------ GABRIEL wakuStart 3")
errMsg := "error WakuStart: " + C.GoStringN(C.getMyCharPtr(resp), C.int(C.getMyCharLen(resp))) errMsg := "error WakuStart: " + C.GoStringN(C.getMyCharPtr(resp), C.int(C.getMyCharLen(resp)))
fmt.Println("------------ GABRIEL error in wakuStart ", errMsg)
return errors.New(errMsg) return errors.New(errMsg)
} }
@ -2457,16 +2449,11 @@ func New(nodeKey *ecdsa.PrivateKey,
onHistoricMessagesRequestFailed func([]byte, peer.ID, error), onHistoricMessagesRequestFailed func([]byte, peer.ID, error),
onPeerStats func(types.ConnStatus)) (*Waku, error) { onPeerStats func(types.ConnStatus)) (*Waku, error) {
fmt.Println("-------- GABRIEL func New 1 ---------")
// Lock the main goroutine to its current OS thread // Lock the main goroutine to its current OS thread
runtime.LockOSThread() runtime.LockOSThread()
fmt.Println("-------- GABRIEL func New 2 ---------")
WakuSetup() // This should only be called once in the whole app's life WakuSetup() // This should only be called once in the whole app's life
fmt.Println("-------- GABRIEL func New 3 ---------")
node, err := wakuNew(nodeKey, node, err := wakuNew(nodeKey,
fleet, fleet,
cfg, logger, appDB, ts, onHistoricMessagesRequestFailed, cfg, logger, appDB, ts, onHistoricMessagesRequestFailed,
@ -2475,21 +2462,17 @@ func New(nodeKey *ecdsa.PrivateKey,
return nil, err return nil, err
} }
fmt.Println("-------- GABRIEL func New 4 ---------")
defaultPubsubTopic, err := node.WakuDefaultPubsubTopic() defaultPubsubTopic, err := node.WakuDefaultPubsubTopic()
if err != nil { if err != nil {
fmt.Println("Error happened:", err.Error()) fmt.Println("Error happened:", err.Error())
} }
fmt.Println("-------- GABRIEL func New 5 ---------")
err = node.WakuRelaySubscribe(defaultPubsubTopic) err = node.WakuRelaySubscribe(defaultPubsubTopic)
if err != nil { if err != nil {
fmt.Println("Error happened:", err.Error()) fmt.Println("Error happened:", err.Error())
} }
fmt.Println("-------- GABRIEL func New 6 ---------")
node.WakuSetEventCallback() node.WakuSetEventCallback()
fmt.Println("-------- GABRIEL func New 7 ---------")
return node, nil return node, nil

View File

@ -228,22 +228,7 @@ func TestBasicWakuV2(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.True(t, slices.Contains(connectedStoreNodes, storeNode.ID), "nwaku should be connected to the store node") require.True(t, slices.Contains(connectedStoreNodes, storeNode.ID), "nwaku should be connected to the store node")
/* // Dropping Peer /*
err = w.DropPeer(storeNode.PeerID)
require.NoError(t, err)
// Dialing with peerID
err = w.DialPeerByID(storeNode.PeerID)
require.NoError(t, err)
err = tt.RetryWithBackOff(func() error {
if len(w.Peers()) < 1 {
return errors.New("no peers discovered")
}
return nil
}, options)
require.NoError(t, err)
filter := &common.Filter{ filter := &common.Filter{
PubsubTopic: config.DefaultShardPubsubTopic, PubsubTopic: config.DefaultShardPubsubTopic,
Messages: common.NewMemoryMessageStore(), Messages: common.NewMemoryMessageStore(),