| 31 |
{ |
{ |
| 32 |
HANDLE hThreadCurrent; |
HANDLE hThreadCurrent; |
| 33 |
ULONG ulThreadId; |
ULONG ulThreadId; |
| 34 |
nntp_active* p; |
base_active* p; |
| 35 |
int t_count = 0; |
int t_count = 0; |
| 36 |
|
|
| 37 |
if (this->running) |
if (this->running) |
| 43 |
|
|
| 44 |
while(!this->IsShutdown()) |
while(!this->IsShutdown()) |
| 45 |
{ |
{ |
| 46 |
if (t_count >= 600 && nntp_active::uThreadCount == 0) |
if (t_count >= 600 && base_active::uThreadCount == 0) |
| 47 |
{ |
{ |
| 48 |
p = new nntp_active(); |
p = new base_active(); |
| 49 |
p->configure(this->innd_id,this->innd_name,this->innd_server,this->innd_uid,this->w_address,this->w_port,this->w_conn_str); |
p->configure(this->innd_id,this->innd_name,this->innd_server,this->innd_uid,this->w_address,this->w_port,this->w_conn_str); |
| 50 |
|
|
| 51 |
if (hThreadCurrent = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)nntp_active::SendThread,(LPVOID)p,0,&ulThreadId)) |
if (hThreadCurrent = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)base_active::SendThread,(LPVOID)p,0,&ulThreadId)) |
| 52 |
{ |
{ |
| 53 |
nntp_active::uThreadCount++; |
base_active::uThreadCount++; |
| 54 |
syslog << logfile::log_head << "Create send thread ... OK" << endl; |
syslog << logfile::log_head << "Create send thread ... OK" << endl; |
| 55 |
} |
} |
| 56 |
else |
else |
| 64 |
t_count++; |
t_count++; |
| 65 |
|
|
| 66 |
//Terminate if timeout(5 minutes) or stopped |
//Terminate if timeout(5 minutes) or stopped |
| 67 |
if ((t_count >= 3000 || this->thread_terminate) && nntp_active::uThreadCount > 0) |
if ((t_count >= 3000 || this->thread_terminate) && base_active::uThreadCount > 0) |
| 68 |
{ |
{ |
| 69 |
if (TerminateThread(hThreadCurrent,-1)) |
if (TerminateThread(hThreadCurrent,-1)) |
| 70 |
{ |
{ |
| 74 |
{ |
{ |
| 75 |
syslog << logfile::log_head << "Terminate send thread ... Failed" << endl; |
syslog << logfile::log_head << "Terminate send thread ... Failed" << endl; |
| 76 |
} |
} |
| 77 |
nntp_active::uThreadCount--; |
base_active::uThreadCount--; |
| 78 |
} |
} |
| 79 |
} |
} |
| 80 |
|
|