From 4bbfad769dd68fb440b9096d3bd329a7c998c037 Mon Sep 17 00:00:00 2001 From: Yan Broetto Date: Tue, 22 Dec 2020 09:46:28 -0300 Subject: [PATCH 1/4] Fixed when you need restart the server with same port --- .../flutter_p2p/wifi_direct/SocketPool.kt | 4 +- example/pubspec.lock | 87 ++++++------------- 2 files changed, 29 insertions(+), 62 deletions(-) diff --git a/android/src/main/kotlin/de/mintware/flutter_p2p/wifi_direct/SocketPool.kt b/android/src/main/kotlin/de/mintware/flutter_p2p/wifi_direct/SocketPool.kt index 7ac4c60..c65987a 100644 --- a/android/src/main/kotlin/de/mintware/flutter_p2p/wifi_direct/SocketPool.kt +++ b/android/src/main/kotlin/de/mintware/flutter_p2p/wifi_direct/SocketPool.kt @@ -21,7 +21,8 @@ class SocketPool(private val inputStreamHandler: StreamHandler) { private val hosts = mutableListOf() fun openSocket(port: Int): Host { - if (getHostByPort(port) != null) { + val h = getHostByPort(port); + if (h != null && !h.serverSocket.isClosed) { throw Exception("A socket with this port already exist") } @@ -43,6 +44,7 @@ class SocketPool(private val inputStreamHandler: StreamHandler) { val socket: Host = getHostByPort(port) ?: throw Exception("A socket with this port is not registered.") socket.serverSocket.close() + hosts.remove(socket); } fun connectToHost(address: String, port: Int, timeout: Int): Client { diff --git a/example/pubspec.lock b/example/pubspec.lock index eeee9b4..8b1a0be 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,27 +1,13 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.13" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.1" + version: "2.4.2" boolean_selector: dependency: transitive description: @@ -29,34 +15,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.0" - charcode: + characters: dependency: transitive description: - name: charcode + name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" - collection: + version: "1.0.0" + charcode: dependency: transitive description: - name: collection + name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.14.12" - convert: + version: "1.1.3" + clock: dependency: transitive description: - name: convert + name: clock url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" - crypto: + version: "1.0.1" + collection: dependency: transitive description: - name: crypto + name: collection url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "1.14.13" cupertino_icons: dependency: "direct main" description: @@ -64,6 +50,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.2" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" fixnum: dependency: transitive description: @@ -88,20 +81,13 @@ packages: description: flutter source: sdk version: "0.0.0" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.12" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.6" + version: "0.12.8" meta: dependency: transitive description: @@ -115,14 +101,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.0" + version: "1.7.0" protobuf: dependency: transitive description: @@ -130,13 +109,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.3" sky_engine: dependency: transitive description: flutter @@ -155,7 +127,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.9.5" stream_channel: dependency: transitive description: @@ -183,14 +155,14 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.15" + version: "0.2.17" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.2.0" vector_math: dependency: transitive description: @@ -198,12 +170,5 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.8" - xml: - dependency: transitive - description: - name: xml - url: "https://pub.dartlang.org" - source: hosted - version: "3.6.1" sdks: - dart: ">=2.6.0 <3.0.0" + dart: ">=2.9.0-14.0.dev <3.0.0" From 1e8e1d1043f6aeba8599877145244a8842b1e384 Mon Sep 17 00:00:00 2001 From: Arkasher <35979893+Arkasher@users.noreply.github.com> Date: Tue, 22 Dec 2020 09:53:08 -0300 Subject: [PATCH 2/4] Delete pubspec.lock --- example/pubspec.lock | 174 ------------------------------------------- 1 file changed, 174 deletions(-) delete mode 100644 example/pubspec.lock diff --git a/example/pubspec.lock b/example/pubspec.lock deleted file mode 100644 index 8b1a0be..0000000 --- a/example/pubspec.lock +++ /dev/null @@ -1,174 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - async: - dependency: transitive - description: - name: async - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.2" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - characters: - dependency: transitive - description: - name: characters - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.3" - clock: - dependency: transitive - description: - name: clock - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" - collection: - dependency: transitive - description: - name: collection - url: "https://pub.dartlang.org" - source: hosted - version: "1.14.13" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.2" - fake_async: - dependency: transitive - description: - name: fake_async - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - fixnum: - dependency: transitive - description: - name: fixnum - url: "https://pub.dartlang.org" - source: hosted - version: "0.10.9" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_p2p: - dependency: "direct dev" - description: - path: ".." - relative: true - source: path - version: "1.0.0" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - matcher: - dependency: transitive - description: - name: matcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.8" - meta: - dependency: transitive - description: - name: meta - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.8" - path: - dependency: transitive - description: - name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.7.0" - protobuf: - dependency: transitive - description: - name: protobuf - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - source_span: - dependency: transitive - description: - name: source_span - url: "https://pub.dartlang.org" - source: hosted - version: "1.7.0" - stack_trace: - dependency: transitive - description: - name: stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.9.5" - stream_channel: - dependency: transitive - description: - name: stream_channel - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - string_scanner: - dependency: transitive - description: - name: string_scanner - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.5" - term_glyph: - dependency: transitive - description: - name: term_glyph - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - test_api: - dependency: transitive - description: - name: test_api - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.17" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - vector_math: - dependency: transitive - description: - name: vector_math - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.8" -sdks: - dart: ">=2.9.0-14.0.dev <3.0.0" From a1a855f0cf0adf5c159d8ad6f8082e7d639e94c2 Mon Sep 17 00:00:00 2001 From: Prateek SU <41370460+prateekmedia@users.noreply.github.com> Date: Fri, 15 Jan 2021 16:03:55 +0530 Subject: [PATCH 3/4] fix errors when adding plugin to pubspec using git --- pubspec.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index cd098bc..c7c021c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -23,6 +23,7 @@ dev_dependencies: flutter: plugin: - android: - package: de.mintware.flutter_p2p - pluginClass: FlutterP2pPlugin \ No newline at end of file + platforms: + android: + package: de.mintware.flutter_p2p + pluginClass: FlutterP2pPlugin From cc6470faefb913822fb1d06c1158335d0a3ca809 Mon Sep 17 00:00:00 2001 From: Prateek SU <41370460+prateekmedia@users.noreply.github.com> Date: Sun, 17 Jan 2021 10:43:10 +0530 Subject: [PATCH 4/4] Remove unneccessary dev dependencies --- pubspec.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index c7c021c..e0119ab 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,13 +14,6 @@ dependencies: flutter: sdk: flutter -dev_dependencies: - flutter_test: - sdk: flutter - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - flutter: plugin: platforms: