从master分支拉取puerts,并拉取v8制品,修改puerts插件部分UE5_5以下兼容的宏代码。保证puerts编译通过。包括
CSharpParamDefaultValueMetas.cs和ubtplugin.csproj和declarationGenerator.cpp和PropertyTranslator.cpp对UserDefinedStruct.h的引用
This commit is contained in:
@@ -50,8 +50,6 @@ var global = global || (function () { return this; }());
|
||||
|
||||
const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];
|
||||
|
||||
const poll_ws_objects = [];
|
||||
|
||||
class WebSocket extends EventTarget {
|
||||
constructor(url, protocols) {
|
||||
super();
|
||||
@@ -72,9 +70,7 @@ var global = global || (function () { return this; }());
|
||||
this._addPendingEvent({type:'close', code:code, reason: reason});
|
||||
},
|
||||
() => {
|
||||
this._addPendingEvent({type:'error'});
|
||||
this._cleanup();
|
||||
this._addPendingEvent({type:'close', code:1006, reason: ""});
|
||||
this._fail();
|
||||
});
|
||||
|
||||
this._readyState = WebSocket.CONNECTING;
|
||||
@@ -92,9 +88,21 @@ var global = global || (function () { return this; }());
|
||||
|
||||
send(data) {
|
||||
if (this._readyState !== WebSocket.OPEN) {
|
||||
throw new Error(`WebSocket is not open: readyState ${this._readyState} (${readyStates[this._readyState]})`);
|
||||
//throw new Error(`WebSocket is not open: readyState ${this._readyState} (${readyStates[this._readyState]})`);
|
||||
this.dispatchEvent({type:'error'}); //dispatchEvent immediately
|
||||
return;
|
||||
}
|
||||
this._raw.send(data);
|
||||
try {
|
||||
this._raw.send(data);
|
||||
} catch {
|
||||
this._fail();
|
||||
}
|
||||
}
|
||||
|
||||
_fail() {
|
||||
this._addPendingEvent({type:'error'});
|
||||
this._cleanup();
|
||||
this._addPendingEvent({type:'close', code:1006, reason: ""});
|
||||
}
|
||||
|
||||
_cleanup() {
|
||||
@@ -111,10 +119,11 @@ var global = global || (function () { return this; }());
|
||||
}
|
||||
const ev = this._pendingEvents.shift();
|
||||
if (ev) this.dispatchEvent(ev);
|
||||
if (this._pendingEvents.length === 0 && this._readyState == WebSocket.CLOSING) {
|
||||
if ((this._pendingEvents.length === 0 && this._readyState == WebSocket.CLOSING) || (ev && ev.type === 'close')) {
|
||||
this._raw = undefined;
|
||||
clearInterval(this._tid);
|
||||
this._readyState = WebSocket.CLOSED;
|
||||
this._pendingEvents = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user