diff --git a/lib/socket/protobuf_server.dart b/lib/socket/protobuf_server.dart index 0add61b..70b17e0 100644 --- a/lib/socket/protobuf_server.dart +++ b/lib/socket/protobuf_server.dart @@ -9,10 +9,13 @@ import 'package:protobuf/protobuf.dart'; abstract class ProtobufServer { List _clientList = []; + bool _started = false; late ServerSocket? _server; final String _host; final int _port; final ProtobufClient Function(Socket) _createNewClient; + + bool get started => _started; ProtobufServer(this._host, this._port, this._createNewClient); @@ -25,6 +28,7 @@ abstract class ProtobufServer client.addListener(onTemplateData); _clientList.add(client); onClientConnected(client); + _started = true; }); return simpleFuture; } @@ -56,5 +60,7 @@ abstract class ProtobufServer Future stop() async { await _server?.close(); + _started = false; + return simpleFuture; } }