From psilord at cs.wisc.edu Fri Jan 8 05:17:11 2010 From: psilord at cs.wisc.edu (Peter Keller) Date: Thu, 7 Jan 2010 23:17:11 -0600 Subject: [iolib-devel] Introductory tcp client/server examples Message-ID: <20100108051711.GA18185@cs.wisc.edu> Hello, I've been writing a tutorial for how to use IOLib loosely following the second edition of the unix network programming book by Richard Stevens. Attached to this mail is a tarball of a collection of example programs I've written which illustrate certain concepts in using IOLib. It is intended that this tutorial go all the way from the simple iterative daytime server example, all the way to nonblocking and multiplexed network i/o for a server with many clients. I am not finished with this work at all (such as the tutorial is simply an outline and I only have a small collection of example programs!), but Stelian wanted to see examples of the code I had written and thought the list would be a good place for it. Thank you. -pete -------------- next part -------------- A non-text attachment was scrubbed... Name: iolib-examples.tar.gz Type: application/octet-stream Size: 3849 bytes Desc: not available URL: From marsijanin at gmail.com Sat Jan 9 17:29:56 2010 From: marsijanin at gmail.com (marsijanin at gmail.com) Date: Sat, 09 Jan 2010 20:29:56 +0300 Subject: [iolib-devel] Serial devices extension: switching from mercurial to git Message-ID: <87eilznq3v.fsf@gmail.com> Good ${current_time_of_day} again! I converted my repo from mercurial to git using `fast-export` (http://repo.or.cz/w/fast-export.git) and placed new git repo at github: http://github.com/marsijanin/iolib.termios/. Hooping that git migration will be useful for future collaboration, Nikolay V. Razbegaiev From psilord at cs.wisc.edu Wed Jan 13 06:18:02 2010 From: psilord at cs.wisc.edu (Peter Keller) Date: Wed, 13 Jan 2010 00:18:02 -0600 Subject: [iolib-devel] accept question Message-ID: <20100113061801.GA769@cs.wisc.edu> Hello, I have a few questions... On a busy server, sometimes a connection to a server aborts before the accept returns. An example is: client calls connect, server gets SYN, sends back SYN,ack, connect returns in the client, the connection is ESTABLISHED, then some time passes, the client sends RST, and *then* the server calls accept. At this point the accept returns ECONNABORTED (well, it depends on the unix distro, actually). Does iolib internally catch this and restart the accept, is there a signaled condition? what does it do? Also, related, how does iolib, or the underlying implementation's accept, deal with EINTR in the various calls? Especially with a nonblocking connect, which usually requires a trip through select() in order to deal with the socket? And, finally, is there any stable interface to the abstracted multiplexer so I can do nonblocking i/o between multiple clients? If not, the only solution left to me is threading, and I'm not sure how sbcl scales to ten thousand+ threads. Instead of the callback method, is there a "give a pile of read/write/except sockets to a fake select which implements the select semantic with real select/pool/kqueue"? Additionally, is there any means to do nonblocking i/o on *standard-input* or *standard-output*? Thank you. -pete From sionescu at common-lisp.net Thu Jan 14 10:00:12 2010 From: sionescu at common-lisp.net (Stelian Ionescu) Date: Thu, 14 Jan 2010 05:00:12 -0500 Subject: [iolib-devel] New patches: 13-Jan-2010 Message-ID: commit cf90ef5196f64994be1f6dde7caa455223d280de Author: Stelian Ionescu Date: Wed Jan 13 22:05:14 2010 +0100 Fix DELETE-FILES: pass correct closure to WALK-DIRECTORY. Bug spotted by Levente M??sz??ros. src/os/os-unix.lisp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) commit 336ed5627fb2d84d819906db72ac1f8a57c2ccc1 Author: Stelian Ionescu Date: Tue Jan 12 19:02:32 2010 +0100 Use package :iolib.sockets in :iolib.trivial-sockets. src/sockets/trivial-sockets.lisp | 52 +++++++++++++++++++------------------- 1 files changed, 26 insertions(+), 26 deletions(-) commit 70c07b60d33d90885cfe1b5cf2b066be6b3b6e04 Author: Stelian Ionescu Date: Tue Jan 12 01:48:55 2010 +0100 Delete spurious .gitignore src/streams/.gitignore | 15 --------------- 1 files changed, 0 insertions(+), 15 deletions(-) commit d44e8f9de268bd7659308bdc9e2407f324862940 Author: Stelian Ionescu Date: Tue Jan 12 01:45:35 2010 +0100 Replace EQ with EQL. src/base/scl-gray-streams.lisp | 2 +- src/iolib/pkgdcl.lisp | 4 ++-- src/os/os-unix.lisp | 4 ++-- src/sockets/dns/lookup.lisp | 4 ++-- src/sockets/dns/query.lisp | 6 +++--- src/sockets/make-socket.lisp | 2 +- src/sockets/namedb/services.lisp | 4 ++-- src/sockets/socket-methods.lisp | 2 +- src/sockets/socket-options.lisp | 4 ++-- src/sockets/trivial-sockets.lisp | 8 ++++---- src/streams/gray/gray-stream-methods.lisp | 22 +++++++++++----------- 11 files changed, 31 insertions(+), 31 deletions(-) commit 6cf587bb302a38a0efe019811ba28f329cdea596 Author: Stelian Ionescu Date: Tue Jan 12 01:20:59 2010 +0100 PRINT-OBJECT for INET-ADDRESS now respects *PACKAGE*. src/sockets/address.lisp | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 90b85eda8d1bedadbb9020a58c8116a78e21e627 Author: Stelian Ionescu Date: Tue Jan 12 01:19:55 2010 +0100 Pass OS environment as optional arg not keyword arg. src/os/os-unix.lisp | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) commit dcecc4adc34ec57cef79dc073d24c6d701eaa30b Author: Stelian Ionescu Date: Fri Jan 8 17:51:58 2010 +0100 Style changes in .asd files: don't qualify ASDF symbols since the file is already loaded into its own *package* that uses ASDF. src/iolib.asd | 10 +++---- src/iolib.base.asd | 4 +- src/iolib.multiplex.asd | 14 ++++------ src/iolib.os.asd | 8 ++---- src/iolib.pathnames.asd | 7 +---- src/iolib.sockets.asd | 53 ++++++++++++++++++++--------------------- src/iolib.streams.asd | 6 +--- src/iolib.syscalls.asd | 21 +++++----------- src/iolib.trivial-sockets.asd | 4 +-- src/iolib.zeta-streams.asd | 11 ++------ 10 files changed, 56 insertions(+), 82 deletions(-) An updated tarball of IOLib's source can be downloaded here: http://common-lisp.net/project/iolib/files/snapshots/iolib-20100113.tar.gz Gitweb URL: http://repo.or.cz/w/iolib.git From psilord at cs.wisc.edu Mon Jan 18 18:19:09 2010 From: psilord at cs.wisc.edu (Peter Keller) Date: Mon, 18 Jan 2010 12:19:09 -0600 Subject: [iolib-devel] event-dispatch Message-ID: <20100118181907.GA12525@cs.wisc.edu> Hello, Under what conditions does event-dispatch return? For example, if I set up a read and write handler on one fd and through the course of the network protocol, one of the handlers decides to close the connection. If this handler calls remove-fd-handlers for the socket's underlying fd in question, is this sufficient to make event-dispath return? Thanks. -pete From psilord at cs.wisc.edu Wed Jan 20 06:18:45 2010 From: psilord at cs.wisc.edu (Peter Keller) Date: Wed, 20 Jan 2010 00:18:45 -0600 Subject: [iolib-devel] event-dispatch In-Reply-To: <20100118181907.GA12525@cs.wisc.edu> References: <20100118181907.GA12525@cs.wisc.edu> Message-ID: <20100120061845.GA6269@cs.wisc.edu> On Mon, Jan 18, 2010 at 12:19:09PM -0600, Peter Keller wrote: > Under what conditions does event-dispatch return? > > For example, if I set up a read and write handler on one fd and through > the course of the network protocol, one of the handlers decides to close > the connection. If this handler calls remove-fd-handlers for the socket's > underlying fd in question, is this sufficient to make event-dispath return? After reading the source, I figured out the if you make-instance the event-base and add :exit-when-empty t to it, then when there are zero monitored fds, the event-dispatch loop will exit. For my purposes at this time, this is good enough. Thank you. -pete From psilord at cs.wisc.edu Wed Jan 20 06:33:26 2010 From: psilord at cs.wisc.edu (Peter Keller) Date: Wed, 20 Jan 2010 00:33:26 -0600 Subject: [iolib-devel] Patch for a nil callback invocation. Message-ID: <20100120063326.GA6590@cs.wisc.edu> Hello, Under the conditions where there are two or more handlers registered for a single fd in the multiplexer and one of the handlers removes all the fd's callbacks and other callbacks for that fd should have been invoked in the same event-dispath iteration, there is an invocation of a nil callback in event-dispatch. To the best of my knowledge, this patch below fixes it. Thank you. -pete diff --git a/src/multiplex/event-loop.lisp b/src/multiplex/event-loop.lisp index 35879fd..4afba32 100644 --- a/src/multiplex/event-loop.lisp +++ b/src/multiplex/event-loop.lisp @@ -306,7 +306,8 @@ within the extent of BODY. Closes VAR." (setf expired-events nil) (setf (values eventsp deletion-list) (dispatch-fd-events-once event-base poll-timeout now)) - (%remove-handlers event-base deletion-list) + (unless (equal '(nil nil) deletion-list) + (%remove-handlers event-base deletion-list)) (when (expire-pending-timers fd-timers now) (setf eventsp t)) (dispatch-fd-timeouts expired-events) (when (expire-pending-timers timers now) (setf eventsp t)) @@ -352,13 +353,14 @@ within the extent of BODY. Closes VAR." (defun %dispatch-event (fd-entry event-type errorp now) (let ((ev (fd-entry-handler fd-entry event-type))) - (funcall (fd-handler-callback ev) - (fd-entry-fd fd-entry) - event-type - (if errorp :error nil)) - (when-let (timer (fd-handler-timer ev)) - (reschedule-timer-relative-to-now timer now)) - (fd-handler-one-shot-p ev))) + (when ev + (funcall (fd-handler-callback ev) + (fd-entry-fd fd-entry) + event-type + (if errorp :error nil)) + (when-let (timer (fd-handler-timer ev)) + (reschedule-timer-relative-to-now timer now)) + (fd-handler-one-shot-p ev)))) (defun dispatch-fd-timeouts (events) (dolist (ev events) From sionescu at common-lisp.net Wed Jan 20 10:00:09 2010 From: sionescu at common-lisp.net (Stelian Ionescu) Date: Wed, 20 Jan 2010 05:00:09 -0500 Subject: [iolib-devel] New patches: 19-Jan-2010 Message-ID: commit bafe0d3f4a561b227387e3c50d6a951aec092b03 Author: Stelian Ionescu Date: Tue Jan 19 17:50:32 2010 +0100 Fix docstrings src/os/os-unix.lisp | 45 ++++++++++++++++++++++----------------------- 1 files changed, 22 insertions(+), 23 deletions(-) commit 211906763f03bda278a480f6918d6c7eca33649c Author: Stelian Ionescu Date: Thu Jan 14 17:42:14 2010 +0100 Signal SUBTYPE-ERROR when a MEMORY-ZSTREAM is initialized with data inconsistent with the specified elementh-type. src/streams/zeta/stream.lisp | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) commit b6be014d6b2d86080e4e0e4f9253cb993d3d7fb9 Author: Stelian Ionescu Date: Thu Jan 14 17:09:48 2010 +0100 Fix typo and untabify. src/streams/zeta/stream.lisp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) commit a93a08d16a86f535dd63d9e331553e3d22ef1092 Author: Stelian Ionescu Date: Thu Jan 14 17:09:24 2010 +0100 Rename IOLIB.ZETA-STREAMS -> IOLIB.ZSTREAMS src/iolib.zeta-streams.asd | 29 ----------------------------- src/iolib.zstreams.asd | 29 +++++++++++++++++++++++++++++ src/streams/zeta/conditions.lisp | 2 +- src/streams/zeta/device.lisp | 2 +- src/streams/zeta/ffi-functions-unix.lisp | 2 +- src/streams/zeta/file-unix.lisp | 2 +- src/streams/zeta/iobuf.lisp | 2 +- src/streams/zeta/pkgdcl.lisp | 2 +- src/streams/zeta/stream.lisp | 2 +- src/streams/zeta/types.lisp | 2 +- 10 files changed, 37 insertions(+), 37 deletions(-) An updated tarball of IOLib's source can be downloaded here: http://common-lisp.net/project/iolib/files/snapshots/iolib-20100119.tar.gz Gitweb URL: http://repo.or.cz/w/iolib.git