gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/rtmp r9767: erase pollds using the index.


From: rob
Subject: [Gnash-commit] /srv/bzr/gnash/rtmp r9767: erase pollds using the index.
Date: Fri, 21 Nov 2008 22:11:00 -0700
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9767
committer: address@hidden
branch nick: rtmp
timestamp: Fri 2008-11-21 22:11:00 -0700
message:
  erase pollds using the index.
modified:
  libnet/handler.cpp
  libnet/handler.h
=== modified file 'libnet/handler.cpp'
--- a/libnet/handler.cpp        2008-11-20 03:28:42 +0000
+++ b/libnet/handler.cpp        2008-11-22 05:11:00 +0000
@@ -167,6 +167,7 @@
     boost::mutex::scoped_lock lock(_poll_mutex);
     _handlers[fd.fd] = func;
      _pollfds.push_back(fd);
+     notify();
 }
 
 void
@@ -175,6 +176,7 @@
 //    GNASH_REPORT_FUNCTION;
     boost::mutex::scoped_lock lock(_poll_mutex);
      _pollfds.push_back(fd);
+     notify();
 }
 
 struct pollfd
@@ -194,27 +196,30 @@
 };
 
 void
+Handler::erasePollFD(int fd)
+{
+//    GNASH_REPORT_FUNCTION;
+    boost::mutex::scoped_lock lock(_poll_mutex);
+    if (_pollfds.size() > 0) {
+       vector<struct pollfd>::iterator it;
+       for (it=_pollfds.begin(); it<_pollfds.end(); it++) {
+           if ((*it).fd == fd) {
+               _pollfds.erase(it);
+           }
+       }
+    }
+}
+
+void
 Handler::erasePollFD(vector<struct pollfd>::iterator &itt)
 {
 //    GNASH_REPORT_FUNCTION;
     boost::mutex::scoped_lock lock(_poll_mutex);
-//    struct pollfd fff = _pollfds.at(fd);
-#if 1
-    if (_pollfds.size() <= 1) {
-       _pollfds.clear();
-    } else {
+    if (_pollfds.size() == 1) {
+       _pollfds.clear();
+     } else {
        _pollfds.erase(itt);
     }
-#else
-    vector<struct pollfd>::iterator it;
-    for (it=_pollfds.begin(); it<_pollfds.end(); it++) {
-       if ((*it).fd == fd) {
-           _pollfds.erase(it);
-       }
-    }
-#endif
-    
-//    _handlers[fd] = 0;
 }
 
 void

=== modified file 'libnet/handler.h'
--- a/libnet/handler.h  2008-11-06 22:45:16 +0000
+++ b/libnet/handler.h  2008-11-22 05:11:00 +0000
@@ -175,6 +175,7 @@
     CQue::que_stats_t *statsout() { return _outgoing.stats(); };
 #endif
     void die() { _die = true; _outgoing.notify(); };
+    void resetDie() { _die = false; };
     bool timetodie() { return _die; };
 
     // The pollfd are an array of data structures used by the poll()
@@ -182,6 +183,7 @@
     // connections get added and disconnected.
     void addPollFD(struct pollfd &fd, entry_t *ptr);
     void addPollFD(struct pollfd &fd);
+    void erasePollFD(int fd);
     void erasePollFD(std::vector<struct pollfd>::iterator &itt);
     struct pollfd &getPollFD(int fd);
     struct pollfd *getPollFDPtr();


reply via email to

[Prev in Thread] Current Thread [Next in Thread]