|
38 | 38 | if g_usegevent == 1:
|
39 | 39 | try:
|
40 | 40 | from gevent import monkey
|
41 |
| - monkey.patch_all(select=False) |
| 41 | + monkey.patch_all(Event=True) |
42 | 42 | g_useOpenSSL = 0
|
43 | 43 | from gevent import sleep
|
44 | 44 | except ImportError:
|
@@ -359,7 +359,7 @@ def getssldomain(self, threadname, ip):
|
359 | 359 | if domain is None and len(gwsname) > 0:
|
360 | 360 | domain="defaultgws"
|
361 | 361 | if domain is not None:
|
362 |
| - PRINT("ip: %s,CN: %s,svr: %s" % (ip, domain,gwsname)) |
| 362 | + PRINT("ip: %s,CN: %s,svr: %s,ok:%d" % (ip, domain,gwsname,checkvalidssldomain(domain,gwsname))) |
363 | 363 | return domain, costtime,timeout,gwsname
|
364 | 364 | else:
|
365 | 365 | s.settimeout(g_conntimeout)
|
@@ -393,7 +393,7 @@ def getssldomain(self, threadname, ip):
|
393 | 393 | if domain is None and len(gwsname) > 0:
|
394 | 394 | domain="defaultgws"
|
395 | 395 | if domain is not None:
|
396 |
| - PRINT("ip: %s,CN: %s,svr: %s" % (ip, domain,gwsname)) |
| 396 | + PRINT("ip: %s,CN: %s,svr: %s,ok:%d" % (ip, domain,gwsname,checkvalidssldomain(domain,gwsname))) |
397 | 397 | return domain, costtime,timeout,gwsname
|
398 | 398 | except SSLError as e:
|
399 | 399 | time_end = time.time()
|
@@ -439,10 +439,20 @@ def getgooglesvrname(self,conn,sock,ip):
|
439 | 439 | conn.write(myreq)
|
440 | 440 | data=""
|
441 | 441 | sock.setblocking(0)
|
| 442 | + selectcnt = 0 |
442 | 443 | while True:
|
443 |
| - infds, outfds, errfds = select.select([sock, ], [], [], g_conntimeout) |
444 |
| - if len(infds) == 0: |
445 |
| - break |
| 444 | + if g_usegevent == 0: |
| 445 | + infds, outfds, errfds = select.select([sock, ], [], [], g_conntimeout) |
| 446 | + if len(infds) == 0: |
| 447 | + return "" |
| 448 | + else: |
| 449 | + infds, outfds, errfds = select.select([sock, ], [], [], 0) |
| 450 | + if len(infds) == 0: |
| 451 | + selectcnt += 1 |
| 452 | + if selectcnt >= 8: |
| 453 | + return "" |
| 454 | + sleep(0.5) |
| 455 | + continue |
446 | 456 | trycnt = 0
|
447 | 457 | while True:
|
448 | 458 | try:
|
|
0 commit comments