Commit 11c3bbc7 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Add initial prompt to local protocol.

parent 62d34f40
...@@ -22,6 +22,7 @@ THE SOFTWARE. ...@@ -22,6 +22,7 @@ THE SOFTWARE.
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
...@@ -213,11 +214,16 @@ local_notify_route(struct route *route, int kind) ...@@ -213,11 +214,16 @@ local_notify_route(struct route *route, int kind)
void void
local_dump() local_dump()
{ {
int i; int i, rc;
const char *header = "BABEL 0.0\n";
if(local_socket < 0) if(local_socket < 0)
return; return;
rc = write_timeout(local_socket, header, strlen(header));
if(rc < 0)
goto fail;
local_notify_self(); local_notify_self();
for(i = 0; i < numneighs; i++) { for(i = 0; i < numneighs; i++) {
if(!neighbour_valid(&neighs[i])) if(!neighbour_valid(&neighs[i]))
...@@ -228,4 +234,9 @@ local_dump() ...@@ -228,4 +234,9 @@ local_dump()
local_notify_xroute(&xroutes[i], LOCAL_ADD); local_notify_xroute(&xroutes[i], LOCAL_ADD);
for(i = 0; i < numroutes; i++) for(i = 0; i < numroutes; i++)
local_notify_route(&routes[i], LOCAL_ADD); local_notify_route(&routes[i], LOCAL_ADD);
return;
fail:
shutdown(local_socket, 1);
return;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment