+void NetChannel::handleRead (void) {
+ SG_LOG(SG_IO, SG_WARN, "Network:" << getHandle() << ": unhandled read");
+}
+
+void NetChannel::handleWrite (void) {
+ SG_LOG(SG_IO, SG_WARN, "Network:" << getHandle() << ": unhandled write");
+}
+
+void NetChannel::handleAccept (void) {
+ SG_LOG(SG_IO, SG_WARN, "Network:" << getHandle() << ": unhandled accept");
+}
+
+void NetChannel::handleError (int error)
+{
+ // warn about address lookup failures seperately, don't warn again.
+ // (and we (ab-)use ENOENT to mean 'name not found'.
+ if (error != ENOENT) {
+ SG_LOG(SG_IO, SG_WARN,"Network:" << getHandle() << ": errno: " << strerror(errno) <<"(" << errno << ")");
+ }
+}
+
+void
+NetChannelPoller::addChannel(NetChannel* channel)
+{
+ assert(channel);
+ assert(channel->poller == NULL);
+
+ channel->poller = this;
+ channels.push_back(channel);
+}
+
+void
+NetChannelPoller::removeChannel(NetChannel* channel)
+{
+ assert(channel);
+ assert(channel->poller == this);
+ channel->poller = NULL;
+
+ // portability: MSVC throws assertion failure when empty
+ if (channels.empty()) {
+ return;
+ }
+
+ ChannelList::iterator it = channels.begin();
+ for (; it != channels.end(); ++it) {
+ if (*it == channel) {
+ channels.erase(it);
+ return;
+ }
+ }
+}
+