Hello

I found the real problem why when Neighbour.store emits the event
'NEIGH_NEW' it results in :
TypeError: 'etp_new_changed() argument after * must be a sequence'

The tip is that in python to express a sequence of just 1 element you
have to add  a trailing coma.

That is

seq = (Neigh())

seq is not a sequence, it is a Neigh.

seq = (Neigh(),)

seq is a sequence with 1 element.

So, in radar.py there are some mistakes.

I attach a patch for it.

But don't hold your breath... I'm already in front of another exception.
Just for curiosity:
Traceback (most recent call last):
  File "ntkd", line 113, in <module>
    main()
  File "ntkd", line 108, in main
    allmicro_run()
  File "/root/netsukuku/trunk/pyntk/ntk/lib/micro.py", line 35, in allmicro_run
    stackless.run()
  File "/root/netsukuku/trunk/pyntk/ntk/core/krnl_route.py", line 77,
in neigh_new
    KRoute.add(ipstr, lvl_to_bits(0), dev, gwipstr)
  File "/root/netsukuku/trunk/pyntk/ntk/network/linux/adapt.py", line
148, in add
    iproute(cmd)
  File "/root/netsukuku/trunk/pyntk/ntk/network/linux/adapt.py", line
61, in iproute
    raise IPROUTECommandError(stderr_value)
ntk.network.linux.adapt.IPROUTECommandError: RTNETLINK answers: No such process


Anyway, here's the patch.
--Luca
Index: pyntk/ntk/core/radar.py
===================================================================
--- pyntk/ntk/core/radar.py	(revision 1515)
+++ pyntk/ntk/core/radar.py	(working copy)
@@ -236,12 +236,12 @@
 
                 # send a message notifying we added a node
                 self.events.send('NEIGH_NEW',
-                                 (Neigh(bestdev=self.ip_table[key].bestdev,
-                                        devs=self.ip_table[key].devs,
+                                 (Neigh(bestdev=ip_table[key].bestdev,
+                                        devs=ip_table[key].devs,
                                         idn=self.ntk_client[key],
                                         ip=key,
                                         netid=self.netid_table[key],
-                                        ntkd=self.translation_table[key])))
+                                        ntkd=self.translation_table[key]),))
             else:
                 # otherwise (if the node already was in old ip_table) check if
                 # its rtt has changed more than rtt_variation
@@ -254,7 +254,7 @@
                                             idn=self.ntk_client[key],
                                             ip=key,
                                             netid=self.netid_table[key],
-                                            ntkd=self.translation_table[key])))
+                                            ntkd=self.translation_table[key]),))
 
         # finally, update the ip_table
         self.ip_table = ip_table
@@ -268,7 +268,7 @@
                                     idn=self.ntk_client[key],
                                     ip=key,
                                     netid=self.netid_table[key],
-                                    ntkd=self.translation_table[key])))
+                                    ntkd=self.translation_table[key]),))
 
 
     def delete(self, ip, remove_from_iptable=True):
@@ -292,7 +292,7 @@
                                 idn=self.ntk_client[ip],
                                 ip=ip,
                                 netid=old_netid,
-                                ntkd=old_id)))
+                                ntkd=old_id),))
 
     def ip_change(self, oldip, newip):
         """Adds `newip' in the Neighbours as a copy of `oldip', then it removes
@@ -312,7 +312,7 @@
                                 idn=self.ntk_client[newip],
                                 ip=newip,
                                 netid=self.netid_table[newip],
-                                ntkd=self.translation_table(newip))))
+                                ntkd=self.translation_table(newip)),))
 
         self.delete(oldip)
 
@@ -390,7 +390,7 @@
 
         # Send the event
         self.bouquet_numb += 1
-        self.events.send('SCAN_DONE', (self.bouquet_numb))
+        self.events.send('SCAN_DONE', (self.bouquet_numb,))
 
     def reply(self, _rpc_caller, ntkd_id, radar_id):
         """ As answer we'll return our netid """
_______________________________________________
Netsukuku mailing list
[email protected]
http://lists.dyne.org/mailman/listinfo/netsukuku

Reply via email to