Rework for TLS.
This commit is contained in:
1 parent
519faa535b
commit
b7deabc5dc
2830 files changed
+4559
-80373
No files matched your search
+27
-26
@@ -1,5 +1,6 @@
|
||||
#include "Thread.h"
|
||||
#include "EPoll.h"
|
||||
#include <sys/epoll.h>
|
||||
|
||||
namespace core {
|
||||
|
||||
@@ -35,43 +36,43 @@ namespace core {
|
||||
}
|
||||
|
||||
void Thread::run() {
|
||||
|
||||
|
||||
threadId = syscall(SYS_gettid);
|
||||
|
||||
|
||||
coreutils::Log(coreutils::LOG_DEBUG_1) << "Thread started with thread id " << threadId << ".";
|
||||
|
||||
|
||||
count = 0;
|
||||
|
||||
|
||||
struct epoll_event events[50];
|
||||
|
||||
|
||||
while(1) {
|
||||
|
||||
if(ePoll.isStopping())
|
||||
|
||||
if(ePoll.isStopping())
|
||||
break;
|
||||
|
||||
status = "WAITING";
|
||||
int rc = epoll_wait(ePoll.getDescriptor(), events, 50, -1);
|
||||
status = "RUNNING";
|
||||
|
||||
if(rc < 0) {
|
||||
// TODO: Make log entry indicating status received and ignore for now.
|
||||
} else if(rc == 0) {
|
||||
break;
|
||||
} else if(rc > 0) {
|
||||
for(int ix = 0; ix < rc; ++ix) {
|
||||
++count;
|
||||
if(((Socket *)events[ix].data.ptr)->eventReceived(events[ix], ++ePoll.eventId)) {
|
||||
// coreutils::Log(coreutils::LOG_DEBUG_4) << "return true";
|
||||
// ePoll.resetSocket((Socket *)events[ix].data.ptr);
|
||||
} else {
|
||||
|
||||
status = "WAITING";
|
||||
int rc = epoll_wait(ePoll.getDescriptor(), events, 50, -1);
|
||||
status = "RUNNING";
|
||||
|
||||
if(rc < 0) {
|
||||
// TODO: Make log entry indicating status received and ignore for now.
|
||||
} else if(rc == 0) {
|
||||
break;
|
||||
} else if(rc > 0) {
|
||||
for(int ix = 0; ix < rc; ++ix) {
|
||||
++count;
|
||||
if(((Socket *)events[ix].data.ptr)->eventReceived(events[ix], ++ePoll.eventId)) {
|
||||
// coreutils::Log(coreutils::LOG_DEBUG_4) << "return true";
|
||||
// ePoll.resetSocket((Socket *)events[ix].data.ptr);
|
||||
} else {
|
||||
((Socket *)events[ix].data.ptr)->shutDown = true;
|
||||
// coreutils::Log(coreutils::LOG_DEBUG_4) << "return false";
|
||||
// coreutils::Log(coreutils::LOG_DEBUG_4) << "return false";
|
||||
delete (Socket *)events[ix].data.ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
coreutils::Log(coreutils::LOG_DEBUG_1) << "Thread ending with thread id " << threadId << ".";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user