runtime-error, value used but not set

Hi all!

We are using bro at Dresden University of Technology to develop a prototype of a mobile wireless ids. I use broccoli to communicate between my local bro and my manager-application.

I need to add and remove peers for inter-bro-communication without restarting bro. Therefore I added some new events to remote.bro to add and remove peers. To close a active connection, I added some lines in RemoteSerializer and bro.bif(_orig) to call RS::CloseConnection.

Adding and connecting new peers works fine, but I get the runtime-error 'value used but not set' when I call close_connection(id). What did I wrong?

Thanks for your help!
Sandro

my changes:

remote.bro:
event broccoli_remove_peer(host : addr)
{
   for(id in connected_peers)
   {
     if(connected_peers[id]$host == host)
     {
       print (fmt("remove peerID '%s', host = %s", id, host));
       close_connection(id);
     }
   }
}

bro.bif / bro.bif.orig:
function close_connection%(id: count%) : bool
%{
   return new Val(remote_serializer->CloseConnection(id),TYPE_BOOL);
%}

RemoteSerializer.h (public):
bool CloseConnection(PeerID id);

RemoteSerializer.cc:
bool RemoteSerializer::CloseConnection(PeerID id)
{
   return CloseConnection(LookupPeer(id, true));
}

That is a script-layer message indicating that script code is
accessing a variable which hasn't been initialized. I don't really
see any problem along with these lines in the code snippets you
posted. Which line does the error message report? Is it the
close_connection() call or some other location?

Robin

Hi!

Adding and connecting new peers works fine, but I get the runtime-error 'value used but not set' when I call close_connection(id). What did I wrong?

That is a script-layer message indicating that script code is
accessing a variable which hasn't been initialized. I don't really
see any problem along with these lines in the code snippets you
posted. Which line does the error message report? Is it the
close_connection() call or some other location?

Yes, the reported line is close_connection(id). But the id is set.
print (fmt("remove peerID '%s', host = %s", id, host)); prints the correct id (I compared it with the id in remote.log).

By the way: did you got my mail about our wireless patch and inter-bro communication I sent some month ago?

Bye,
Sandro

Yes, the reported line is close_connection(id). But the id is set.
print (fmt("remove peerID '%s', host = %s", id, host)); prints the
correct id (I compared it with the id in remote.log).

Hmmm... Dann scheint mir das ein Fall fuer den Debugger, da ich so
momentan keine gute Idee habe. Kannst Du mal auf run_time() einen
Breakspoint setzen und mit den Stack-Backtrace schicken?

By the way: did you got my mail about our wireless patch and inter-bro
communication I sent some month ago?

Um, ja, die wartet immer noch auf Bearbeitung. Mir fehlte nach der
langen Pause der Kontext um sofort genauer reinzuschauen und wie's
so ist, bleibt's dann liegen... Ich werd nochmal schauen. (Brauchst
Du was bestimmtes?)

Robin

Um, sorry, this was obviously not supposed go to the list. :slight_smile:

Robin