|
@@ -757,7 +757,8 @@ static struct evconnlistener *controller_create(struct event_base *evbase,
|
|
|
ip, boundport, false);
|
|
ip, boundport, false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-int controller_main(const Worklist &worklist, unsigned short bindport)
|
|
|
|
|
|
|
+int controller_main(const Worklist &worklist, unsigned short bindport,
|
|
|
|
|
+ void (*boundcb)(const char *boundaddr, unsigned short boundport))
|
|
|
{
|
|
{
|
|
|
// Initialize the prng with some randomness from the kernel
|
|
// Initialize the prng with some randomness from the kernel
|
|
|
unsigned char randbuf[1024];
|
|
unsigned char randbuf[1024];
|
|
@@ -786,8 +787,10 @@ int controller_main(const Worklist &worklist, unsigned short bindport)
|
|
|
unsigned short myport;
|
|
unsigned short myport;
|
|
|
|
|
|
|
|
ctrlstate.listener = controller_create(evbase, bindport, &myip, &myport);
|
|
ctrlstate.listener = controller_create(evbase, bindport, &myip, &myport);
|
|
|
- struct in_addr myaddr = { myip };
|
|
|
|
|
- printf("Bound to %s:%d\n", inet_ntoa(myaddr), ntohs(myport));
|
|
|
|
|
|
|
+ if (ctrlstate.listener && boundcb) {
|
|
|
|
|
+ struct in_addr myaddr = { myip };
|
|
|
|
|
+ boundcb(inet_ntoa(myaddr), ntohs(myport));
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// Kick off the first problem to solve
|
|
// Kick off the first problem to solve
|
|
|
generate_problem(evbase);
|
|
generate_problem(evbase);
|