(file) Return to Monitor.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/Monitor.cpp between version 1.26 and 1.27

version 1.26, 2002/06/20 14:55:38 version 1.27, 2002/06/20 22:05:18
Line 184 
Line 184 
           FD_SET(_entries[indx].socket, &fdread);           FD_SET(_entries[indx].socket, &fdread);
        }        }
     }     }
     _entries_mut.unlock();  
  
     int events = select(FD_SETSIZE, &fdread, NULL, NULL, &tv);     int events = select(FD_SETSIZE, &fdread, NULL, NULL, &tv);
  
Line 201 
Line 200 
              MessageQueue *q = MessageQueue::lookup(_entries[indx].queueId);              MessageQueue *q = MessageQueue::lookup(_entries[indx].queueId);
              if(q == 0)              if(q == 0)
              {              {
                 unsolicitSocketMessages(indx);                  _entries[indx]._status = _MonitorEntry::EMPTY;
                   _entries_mut.unlock();
                 return true;                 return true;
              }              }
  
Line 211 
Line 211 
                 if(static_cast<HTTPConnection *>(q)->_dying.value() > 0 )                 if(static_cast<HTTPConnection *>(q)->_dying.value() > 0 )
                 {                 {
                    _entries[indx]._status = _MonitorEntry::DYING;                    _entries[indx]._status = _MonitorEntry::DYING;
   
                    MessageQueue & o = static_cast<HTTPConnection *>(q)->get_owner();                    MessageQueue & o = static_cast<HTTPConnection *>(q)->get_owner();
                    Message* message= new CloseConnectionMessage(_entries[indx].socket);                    Message* message= new CloseConnectionMessage(_entries[indx].socket);
                    message->dest = o.getQueueId();                    message->dest = o.getQueueId();
                      _entries_mut.unlock();
                    o.enqueue(message);                    o.enqueue(message);
                    return true;                    return true;
                 }                 }
   
                 _entries[indx]._status = _MonitorEntry::BUSY;                 _entries[indx]._status = _MonitorEntry::BUSY;
                   _entries_mut.unlock();
                 _thread_pool->allocate_and_awaken((void *)q, _dispatch);                 _thread_pool->allocate_and_awaken((void *)q, _dispatch);
                   _entries_mut.lock(pegasus_thread_self());
              }              }
              else              else
              {              {
                 int events = 0;                 int events = 0;
   
                 events |= SocketMessage::READ;                 events |= SocketMessage::READ;
                 Message *msg = new SocketMessage(_entries[indx].socket, events);                 Message *msg = new SocketMessage(_entries[indx].socket, events);
                 _entries[indx]._status = _MonitorEntry::BUSY;                  _entries_mut.unlock();
                 q->enqueue(msg);                 q->enqueue(msg);
                 _entries[indx]._status = _MonitorEntry::IDLE;  
                 return true;                 return true;
              }              }
              handled_events = true;              handled_events = true;
           }           }
        }        }
     }     }
       _entries_mut.unlock();
     return(handled_events);     return(handled_events);
 } }
  
Line 260 
Line 262 
    {    {
       if(_entries[index]._status == _MonitorEntry::EMPTY)       if(_entries[index]._status == _MonitorEntry::EMPTY)
       {       {
          _entries[index] = entry;           _entries[index].operator =(entry);
          found = true;          found = true;
          break;          break;
       }       }
Line 270 
Line 272 
       _entries.append(entry);       _entries.append(entry);
       index = _entries.size() - 1;       index = _entries.size() - 1;
    }    }
    _entries_mut.unlock();  
    _connections++;    _connections++;
      _entries_mut.unlock();
   
    PEG_METHOD_EXIT();    PEG_METHOD_EXIT();
    return index;    return index;
 } }
Line 282 
Line 285 
  
     _entries_mut.lock(pegasus_thread_self());     _entries_mut.lock(pegasus_thread_self());
  
       Boolean found = false;
   
     for(int index = 0; index < (int)_entries.size(); index++)     for(int index = 0; index < (int)_entries.size(); index++)
     {     {
        if(_entries[index].socket == socket)        if(_entries[index].socket == socket)
        {        {
             found = true;
             _connections--;
           _entries[index]._status = _MonitorEntry::EMPTY;           _entries[index]._status = _MonitorEntry::EMPTY;
        }        }
     }     }
     _entries_mut.unlock();     _entries_mut.unlock();
       PEGASUS_ASSERT(found == true);
  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
 } }
Line 299 
Line 307 
 PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL Monitor::_dispatch(void *parm) PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL Monitor::_dispatch(void *parm)
 { {
    HTTPConnection *dst = reinterpret_cast<HTTPConnection *>(parm);    HTTPConnection *dst = reinterpret_cast<HTTPConnection *>(parm);
   
    dst->run(1);    dst->run(1);
    if( dst->_monitor->_entries.size() > dst->_entry_index )  
       dst->_monitor->_entries[dst->_entry_index]._status = _MonitorEntry::IDLE;  
   
    return 0;    return 0;
 } }
  


Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2