Changeset 376
- Timestamp:
- 06/08/07 10:45:23 (2 years ago)
- Files:
-
- version_0/ext/ed.cpp (modified) (9 diffs)
- version_0/ext/ed.h (modified) (3 diffs)
- version_0/ext/pipe.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
version_0/ext/ed.cpp
r373 r376 45 45 46 46 EventableDescriptor::EventableDescriptor (int sd, EventMachine_t *em): 47 bCloseNow (false), 48 bCloseAfterWriting (false), 47 49 EventCallback (NULL), 48 50 LastRead (0), 49 51 LastWritten (0), 50 52 MySocket (sd), 51 bCloseNow (false),52 bCloseAfterWriting (false),53 53 bCallbackUnbind (true), 54 54 MyEventMachine (em) … … 149 149 void EventableDescriptor::ScheduleClose (bool after_writing) 150 150 { 151 // KEEP THIS SYNCHRONIZED WITH ::IsCloseScheduled. 151 152 if (after_writing) 152 153 bCloseAfterWriting = true; 153 154 else 154 155 bCloseNow = true; 156 } 157 158 159 /************************************* 160 EventableDescriptor::IsCloseScheduled 161 *************************************/ 162 163 bool EventableDescriptor::IsCloseScheduled() 164 { 165 // KEEP THIS SYNCHRONIZED WITH ::ScheduleClose. 166 return (bCloseNow || bCloseAfterWriting); 155 167 } 156 168 … … 274 286 // (Well, not so bad, small pages are coalesced in ::Write) 275 287 276 if (bCloseNow || bCloseAfterWriting) 288 if (IsCloseScheduled()) 289 //if (bCloseNow || bCloseAfterWriting) 277 290 return 0; 278 291 … … 421 434 // If we read no data on a socket that selected readable, 422 435 // it generally means the other end closed the connection gracefully. 423 bCloseNow = true; 436 ScheduleClose (false); 437 //bCloseNow = true; 424 438 } 425 439 … … 502 516 } 503 517 else 504 bCloseNow = true; 518 ScheduleClose (false); 519 //bCloseNow = true; 505 520 } 506 521 else { … … 685 700 if (bConnectPending) { 686 701 if ((gCurrentLoopTime - CreatedAt) >= PendingConnectTimeout) 687 bCloseNow = true; 702 ScheduleClose (false); 703 //bCloseNow = true; 688 704 } 689 705 else { 690 706 if (InactivityTimeout && ((gCurrentLoopTime - LastIo) >= InactivityTimeout)) 691 bCloseNow = true; 707 ScheduleClose (false); 708 //bCloseNow = true; 692 709 } 693 710 } … … 888 905 // Close it if its inactivity timer has expired. 889 906 890 if (InactivityTimeout && ((gCurrentLoopTime - LastIo) >= InactivityTimeout)) 891 bCloseNow = true; 907 if (InactivityTimeout && ((gCurrentLoopTime - LastIo) >= InactivityTimeout)) 908 ScheduleClose (false); 909 //bCloseNow = true; 892 910 } 893 911 … … 1038 1056 // That means it needs to move to a common ancestor. 1039 1057 1040 if (bCloseNow || bCloseAfterWriting) 1058 if (IsCloseScheduled()) 1059 //if (bCloseNow || bCloseAfterWriting) 1041 1060 return 0; 1042 1061 … … 1069 1088 // TODO: Refactor this so there's no overlap with SendOutboundData. 1070 1089 1071 if (bCloseNow || bCloseAfterWriting) 1090 if (IsCloseScheduled()) 1091 //if (bCloseNow || bCloseAfterWriting) 1072 1092 return 0; 1073 1093 version_0/ext/ed.h
r372 r376 58 58 59 59 void ScheduleClose (bool after_writing); 60 bool IsCloseScheduled(); 60 61 61 62 void SetEventCallback (void (*cb)(const char*, int, const char*, int)); … … 73 74 struct epoll_event *GetEpollEvent() { return &EpollEvent; } 74 75 #endif 76 77 private: 78 bool bCloseNow; 79 bool bCloseAfterWriting; 75 80 76 81 protected: … … 85 90 time_t LastWritten; 86 91 int MySocket; 87 bool bCloseNow;88 bool bCloseAfterWriting;89 92 bool bCallbackUnbind; 90 93 version_0/ext/pipe.cpp
r372 r376 133 133 // If we read no data on a socket that selected readable, 134 134 // it generally means the other end closed the connection gracefully. 135 bCloseNow = true; 135 ScheduleClose (false); 136 //bCloseNow = true; 136 137 } 137 138 … … 208 209 // If an inactivity timeout is defined, then check for it. 209 210 if (InactivityTimeout && ((gCurrentLoopTime - LastIo) >= InactivityTimeout)) 210 bCloseNow = true; 211 ScheduleClose (false); 212 //bCloseNow = true; 211 213 } 212 214 … … 247 249 int PipeDescriptor::SendOutboundData (const char *data, int length) 248 250 { 249 if (bCloseNow || bCloseAfterWriting) 251 //if (bCloseNow || bCloseAfterWriting) 252 if (IsCloseScheduled()) 250 253 return 0; 251 254
