diff --git a/examples/bstr.c b/examples/bstr.c index d77c607..6f42e80 100644 --- a/examples/bstr.c +++ b/examples/bstr.c @@ -24,7 +24,7 @@ int main(void) { FIO_STRING_WRITE_STR1(". The answer is: "), FIO_STRING_WRITE_UNUM(42)); printf("Original string: %s\n", org); - printf("Copied string: %s\n", copy); + printf("Edited string: %s\n", copy); fio_bstr_free(org); fio_bstr_free(copy); } diff --git a/examples/chat.c b/examples/chat.c index 8369761..6a947f7 100644 --- a/examples/chat.c +++ b/examples/chat.c @@ -33,11 +33,13 @@ FIO_SFUNC void on_data_chat(fio_io_s *io); FIO_SFUNC void on_shutdown(fio_io_s *io); /** Called when the monitored IO is closed or has a fatal error. */ FIO_SFUNC void on_close(void *buf, void *udata); +/** Called when the monitored IO is closed or has a fatal error. */ +FIO_SFUNC void on_close_unconnected(void *buf, void *udata); static fio_io_protocol_s CHAT_PROTOCOL_LOGIN = { .on_attach = on_login_start, .on_data = on_data_login, - .on_close = on_close, + .on_close = on_close_unconnected, }; static fio_io_protocol_s CHAT_PROTOCOL_CHAT = { .on_data = on_data_chat, @@ -98,6 +100,13 @@ FIO_SFUNC void on_close(void *buf, void *udata) { (void)buf; } +/** Called when the monitored IO is closed or has a fatal error. */ +FIO_SFUNC void on_close_unconnected(void *buf, void *udata) { + client_s *c = udata; + client_free(c); + (void)buf; +} + /** Performs "login" logic (saves user handle) */ FIO_SFUNC void on_data_first_line(fio_io_s *io, char *name, size_t len) { if (!len) diff --git a/examples/client.c b/examples/client.c index 01ebe1b..68dbcbd 100644 --- a/examples/client.c +++ b/examples/client.c @@ -84,8 +84,17 @@ int main(int argc, char const *argv[]) { 1, "A simple TCP/IP, Unix or UDP client application. Requires a URL " "type address. i.e.\n" - "\tNAME \n\n" - "Unix socket examples:\n" + "\tNAME \n" + "\nHTTP examples:\n" + "\tNAME http://google.com/\n" + "\tNAME https://google.com/\n" + "\nWebSocket examples:\n" + "\tNAME ws://localhost:3000/\n" + "\tNAME wss://localhost:3000/\n" + "\nSSE (Server Sent Events) examples:\n" + "\tNAME sse://localhost:3000/\n" + "\tNAME sses://localhost:3000/\n" + "\nUnix socket examples:\n" "\tNAME unix://./my.sock\n" "\tNAME /full/path/to/my.sock\n" "\nTCP/IP socket examples:\n"