File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -44,13 +44,21 @@ class Server {
4444 // create() constructs and returns a new Server.
4545 static std::unique_ptr<Server> create ();
4646
47- // start() begins listening for connections on the given port.
47+ // start() begins listening for connections on localhost and the given port.
4848 // callback will be called for each connection.
4949 // onError will be called for any connection errors.
5050 virtual bool start (int port,
5151 const OnConnect& callback,
5252 const OnError& onError = ignoreErrors) = 0;
5353
54+ // start() begins listening for connections on the given specific address and port.
55+ // callback will be called for each connection.
56+ // onError will be called for any connection errors.
57+ virtual bool start (const char * address,
58+ int port,
59+ const OnConnect& callback,
60+ const OnError& onError = ignoreErrors) = 0;
61+
5462 // stop() stops listening for connections.
5563 // stop() is implicitly called on destruction.
5664 virtual void stop () = 0;
Original file line number Diff line number Diff line change @@ -32,10 +32,17 @@ class Impl : public dap::net::Server {
3232 bool start (int port,
3333 const OnConnect& onConnect,
3434 const OnError& onError) override {
35+ return start (" localhost" , port, onConnect, onError);
36+ }
37+
38+ bool start (const char * address,
39+ int port,
40+ const OnConnect& onConnect,
41+ const OnError& onError) override {
3542 std::unique_lock<std::mutex> lock (mutex);
3643 stopWithLock ();
3744 socket = std::unique_ptr<dap::Socket>(
38- new dap::Socket (" localhost " , std::to_string (port).c_str ()));
45+ new dap::Socket (address , std::to_string (port).c_str ()));
3946
4047 if (!socket->isOpen ()) {
4148 onError (" Failed to open socket" );
You can’t perform that action at this time.
0 commit comments