Revision 999c60b4

View differences:

src/connectionmanager.cpp
18 18

  
19 19
#include "config.h"
20 20
#include "connectionmanager.h"
21
#include "recordconnection.h"
21 22
#include "connection.h"
22 23

  
23 24
ConnectionManager::~ConnectionManager()
......
61 62
    i++;
62 63
  }
63 64
}
65

  
66
bool ConnectionManager::removeJob(int job)
67
{
68
  for (ConnectionList::iterator i = connections.begin(); i != connections.end(); ) {
69
    RecordConnection *c = dynamic_cast<RecordConnection *>(*i);
70
    if (c != NULL && c->getJob() == job) {
71
      // Close terminated connections
72
      connections.erase(i);
73
      delete c;
74
      return true;
75
    }
76
    i++;
77
  }
78
  return false;
79
}
src/connectionmanager.h
40 40
  const_iterator begin() const { return connections.begin(); }
41 41
  const_iterator end() const { return connections.end(); }
42 42

  
43
  bool removeJob(int job);
44

  
43 45
private:
44 46
  typedef std::list<Connection *> ConnectionList;
45 47
  ConnectionList connections;

Also available in: Unified diff