event: incoming HTTP request
timestamp: 2024-08-08T01:33:21.153Z
remoteAddress: “::ffff:192.168.10.20”
deviceId: 6C3845-MR820%2DKK-CAAD96C3845D197B0
connection: 2024-08-08T01:33:21.153Z
localPort: 9090
method: POST
url: /
headers:
host: 192.168.10.178:9090
user-agent: TR069_AGENT/1.0
content-length: “3307”
connection: keep-alive
content-type: text/xml; charset=utf-8
soapaction: “”
body: >
event: outgoing HTTP response
timestamp: 2024-08-08T01:33:21.154Z
remoteAddress: “::ffff:192.168.10.20”
deviceId: 6C3845-MR820%2DKK-CAAD96C3845D197B0
connection: 2024-08-08T01:33:21.153Z
statusCode: 200
headers:
content-length: 530
server: GenieACS/1.2.13+240808efdd
soapserver: GenieACS/1.2.13+240808efdd
content-type: text/xml; charset=“utf-8”
set-cookie: session=cfd19ec34cc8fdf1
body: >-
<?xml version="1.0" encoding="UTF-8"?>
// inform 函数优化版本
async function inform(
sessionContext: SessionContext,
rpc: SoapMessage,
): Promise<{ code: number; headers: Record<string, string>; data: string }> {
// 获取会话锁
if (!sessionContext.lock) {
sessionContext.lock = true;
} else {
// 如果会话已经在处理中,返回 400 错误,提示 CPE 已在会话中
return {
code: 400,
headers: {
‘Content-Length’: ‘19’,
‘Connection’: ‘close’,
},
data: ‘CPE 已在会话中’,
};
}
try {
// 处理 Inform 请求
const acsResponse = await session.inform(
sessionContext,
rpc.cpeRequest as InformRequest,
);
const res = soap.response({
id: rpc.id,
acsResponse: acsResponse,
cwmpVersion: sessionContext.cwmpVersion,
});
// 设置 Cookie
const cookiesPath = localCache.getConfig(
sessionContext.cacheSnapshot,
"cwmp.cookiesPath",
{},
sessionContext.timestamp,
(e) => session.configContextCallback(sessionContext, e),
);
res.headers["Set-Cookie"] = `session=${sessionContext.sessionId}; Path=${cookiesPath || '/'}`;
return res;
} catch (error) {
// 错误处理
console.error(‘Inform request processing error:’, error);
return {
code: 500,
headers: {},
data: ‘Internal Server Error’,
};
} finally {
// 释放会话锁
sessionContext.lock = false;
}
}
Perfect, solved the issue of some CPEs failing to come online. There was a bug in inform, which I have optimized. After optimization, all CPEs can now come online normally. File directory:/lib/cwmp.ts