Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class SocketPool(private val inputStreamHandler: StreamHandler) {
private val hosts = mutableListOf<Host>()

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")
}

Expand All @@ -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 {
Expand Down
209 changes: 0 additions & 209 deletions example/pubspec.lock

This file was deleted.

14 changes: 4 additions & 10 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,9 @@ 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:
android:
package: de.mintware.flutter_p2p
pluginClass: FlutterP2pPlugin
platforms:
android:
package: de.mintware.flutter_p2p
pluginClass: FlutterP2pPlugin