Commit 9b558d2c authored by liyuanhong's avatar liyuanhong

修改了一个bug2

parent 4b0339f8
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -60,7 +60,7 @@ class ClientSocket(SocketBase):
#####################################################
def close(self):
# self.client.send("_end".encode()) //发送一个socket断开的命令
self.client.shutdown()
self.client.shutdown(socket.SHUT_RDWR)
self.client.close()
self.status = 0
......
......@@ -104,7 +104,6 @@ class M500PressureServer():
startTime = self.startTime
while self.serviceStatus == 1:
time.sleep(self.sendDur)
gpsMsg = ""
OBDMsg = ""
if self.travelStatus == 0:
......@@ -342,15 +341,15 @@ class M500PressureServer():
self.serviceTravel()
########################################################
# 停止行驶的服务
# 停止行驶的服务(同时会停止线程)
########################################################
def stopTravelService(self):
# self.fireOff()
self.fireOff()
self.serviceStatus = 0
self.gpsLine = []
self.gpsLineIndex = 0
self.travelStatus = 0
# self.socket.close()
self.socket.close()
########################################################
#接收消息方法
......@@ -415,7 +414,7 @@ class M500PressureServer():
self.startTime = int(time.time())
while True:
endTime = int(time.time())
if (self.startTime - endTime) > self.durTime:
if (endTime - self.startTime) > self.durTime:
break
try:
self.sn = 1
......@@ -441,7 +440,7 @@ class M500PressureServer():
self.writeToFile("data/log1.txt", err, type=1)
print(self.threadName + "线程出现异常\n")
self.writeToFile("data/log1.txt",self.threadName + "线程出现异常\n", type=1)
if (self.startTime - endTime) > 180:
if (self.durTime - (endTime - self.startTime)) > 180:
time.sleep(180)
else:
break
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -15,8 +15,8 @@ def writeToFile(path,data,type=1): #1:代表追加 0:代表覆盖
with open(path, "w", encoding='utf-8') as fi:
fi.write(data)
carNums = 100 #模拟器数量
durTime = 600 #线程持续的时间
carNums = 4000 #模拟器数量
durTime = 3600 #线程持续的时间
startDin = 202008280000 #开始的车机号
info = {} #存放脚本运行时的信息
info["threadsObj"] = {} #用于运行线程的字典
......@@ -34,7 +34,7 @@ def startSimulaterService():
autoCarObj.setHost("172.19.7.6")
autoCarObj.setPort(49008)
autoCarObj.setInfo(info)
autoCarObj.setSendDur(1)
autoCarObj.setSendDur(5)
autoCarObj.setCarId(carId)
autoCarObj.setDurTime(durTime)
threadId = "thread_" + str(i)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment