From c6d13abddcc5c268e65843f57812e7b51a368ebf Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Wed, 17 May 2017 01:00:03 +0300 Subject: [PATCH] Small cleanup in demos (#572) --- samples/gtk/src/Main.kt | 11 +++++------ samples/nonBlockingEchoServer/EchoServer.kt | 8 +------- samples/nonBlockingEchoServer/README.md | 5 ++++- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/samples/gtk/src/Main.kt b/samples/gtk/src/Main.kt index f26ef81eccd..c6cc1da0983 100644 --- a/samples/gtk/src/Main.kt +++ b/samples/gtk/src/Main.kt @@ -28,24 +28,23 @@ fun > g_signal_connect(obj: CPointer<*>, actionName: String, fun activate(app: CPointer?, user_data: gpointer?) { val windowWidget = gtk_application_window_new(app)!! val window = windowWidget.reinterpret() - gtk_window_set_title(window, "Window"); + gtk_window_set_title(window, "Window") gtk_window_set_default_size(window, 200, 200) val button_box = gtk_button_box_new( GtkOrientation.GTK_ORIENTATION_HORIZONTAL)!! - gtk_container_add(window.reinterpret(), button_box); + gtk_container_add(window.reinterpret(), button_box) val button = gtk_button_new_with_label("Konan говорит: click me!")!! g_signal_connect(button, "clicked", - staticCFunction { widget: CPointer?, data: gpointer? -> - println("Hi Kotlin") - }); + staticCFunction { _: CPointer?, _: gpointer? -> println("Hi Kotlin") + }) g_signal_connect(button, "clicked", staticCFunction { widget: CPointer? -> gtk_widget_destroy(widget) }, window, G_CONNECT_SWAPPED) - gtk_container_add (button_box.reinterpret(), button); + gtk_container_add (button_box.reinterpret(), button) gtk_widget_show_all(windowWidget) } diff --git a/samples/nonBlockingEchoServer/EchoServer.kt b/samples/nonBlockingEchoServer/EchoServer.kt index 141ec6a0dc4..72124b66893 100644 --- a/samples/nonBlockingEchoServer/EchoServer.kt +++ b/samples/nonBlockingEchoServer/EchoServer.kt @@ -194,13 +194,7 @@ fun acceptClientsAndRun(serverFd: Int, block: suspend Client.() -> Unit) { } } -class IOException: RuntimeException { - constructor() : super() { - } - - constructor(message: String): super(message) { - } -} +class IOException(message: String): RuntimeException(message) val errno: Int get() = interop_errno() diff --git a/samples/nonBlockingEchoServer/README.md b/samples/nonBlockingEchoServer/README.md index 54f19d95ce3..cda8c5d979e 100644 --- a/samples/nonBlockingEchoServer/README.md +++ b/samples/nonBlockingEchoServer/README.md @@ -19,11 +19,14 @@ Run the server: ./EchoServer.kexe 3000 & -Test the server by conecting to it, for example with telnet: +Test the server by connecting to it, for example with telnet: telnet localhost 3000 Write something to console and watch server echoing it back. +Concurrently connect from another terminal. Note that each connection gets its own +connection id prefixed to echo response. + ~~Quit telnet by pressing ctrl+] ctrl+D~~