|
a/src/netcon.cpp |
|
b/src/netcon.cpp |
|
... |
|
... |
38 |
#include <arpa/inet.h>
|
38 |
#include <arpa/inet.h>
|
39 |
#include <netdb.h>
|
39 |
#include <netdb.h>
|
40 |
|
40 |
|
41 |
#include <map>
|
41 |
#include <map>
|
42 |
|
42 |
|
43 |
using namespace std;
|
|
|
44 |
|
43 |
|
45 |
#ifdef HAVE_DEBUGLOG
|
44 |
#ifdef HAVE_DEBUGLOG
|
46 |
#include "debuglog.h"
|
45 |
#include "debuglog.h"
|
47 |
|
46 |
|
48 |
#else
|
47 |
#else
|
|
... |
|
... |
182 |
FD_ZERO(&wd);
|
181 |
FD_ZERO(&wd);
|
183 |
|
182 |
|
184 |
// Walk the netcon map and set up the read and write fd_sets
|
183 |
// Walk the netcon map and set up the read and write fd_sets
|
185 |
// for select()
|
184 |
// for select()
|
186 |
nfds = 0;
|
185 |
nfds = 0;
|
187 |
for (map<int, NetconP>::iterator it = m_polldata.begin();
|
186 |
for (std::map<int, NetconP>::iterator it = m_polldata.begin();
|
188 |
it != m_polldata.end(); it++) {
|
187 |
it != m_polldata.end(); it++) {
|
189 |
NetconP& pll = it->second;
|
188 |
NetconP& pll = it->second;
|
190 |
int fd = it->first;
|
189 |
int fd = it->first;
|
191 |
LOGDEB2(("Selectloop: fd %d flags 0x%x\n", fd, pll->m_wantedEvents));
|
190 |
LOGDEB2(("Selectloop: fd %d flags 0x%x\n", fd, pll->m_wantedEvents));
|
192 |
if (pll->m_wantedEvents & Netcon::NETCONPOLL_READ) {
|
191 |
if (pll->m_wantedEvents & Netcon::NETCONPOLL_READ) {
|
|
... |
|
... |
258 |
canwrite ? "write" : ""));
|
257 |
canwrite ? "write" : ""));
|
259 |
if (none) {
|
258 |
if (none) {
|
260 |
continue;
|
259 |
continue;
|
261 |
}
|
260 |
}
|
262 |
|
261 |
|
263 |
map<int, NetconP>::iterator it = m_polldata.find(fd);
|
262 |
std::map<int, NetconP>::iterator it = m_polldata.find(fd);
|
264 |
if (it == m_polldata.end()) {
|
263 |
if (it == m_polldata.end()) {
|
265 |
/// This should not happen actually
|
264 |
/// This should not happen actually
|
266 |
LOGDEB2(("Netcon::selectloop: fd %d not found\n", fd));
|
265 |
LOGDEB2(("Netcon::selectloop: fd %d not found\n", fd));
|
267 |
continue;
|
266 |
continue;
|
268 |
}
|
267 |
}
|
|
... |
|
... |
307 |
{
|
306 |
{
|
308 |
if (!con) {
|
307 |
if (!con) {
|
309 |
return -1;
|
308 |
return -1;
|
310 |
}
|
309 |
}
|
311 |
LOGDEB1(("Netcon::remselcon: fd %d\n", con->m_fd));
|
310 |
LOGDEB1(("Netcon::remselcon: fd %d\n", con->m_fd));
|
312 |
map<int, NetconP>::iterator it = m_polldata.find(con->m_fd);
|
311 |
std::map<int, NetconP>::iterator it = m_polldata.find(con->m_fd);
|
313 |
if (it == m_polldata.end()) {
|
312 |
if (it == m_polldata.end()) {
|
314 |
LOGDEB1(("Netcon::remselcon: con not found for fd %d\n", con->m_fd));
|
313 |
LOGDEB1(("Netcon::remselcon: con not found for fd %d\n", con->m_fd));
|
315 |
return -1;
|
314 |
return -1;
|
316 |
}
|
315 |
}
|
317 |
con->setloop(0);
|
316 |
con->setloop(0);
|