fix(core): some dumb null checks
This commit is contained in:
parent
a0a22554cb
commit
0d3c18b885
2 changed files with 5 additions and 4 deletions
|
@ -1771,7 +1771,6 @@ export class SessionConnection extends PersistentConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = writer.result()
|
const result = writer.result()
|
||||||
// probably the easiest way lol
|
|
||||||
|
|
||||||
this.log.debug(
|
this.log.debug(
|
||||||
'sending %d messages: size = %db, acks = %d (msg_id = %s), ping = %s (msg_id = %s), state_req = %s (msg_id = %s), resend = %s (msg_id = %s), cancels = %s (msg_id = %s), rpc = %s, container = %s, root msg_id = %l',
|
'sending %d messages: size = %db, acks = %d (msg_id = %s), ping = %s (msg_id = %s), state_req = %s (msg_id = %s), resend = %s (msg_id = %s), cancels = %s (msg_id = %s), rpc = %s, container = %s, root msg_id = %l',
|
||||||
|
@ -1800,7 +1799,9 @@ export class SessionConnection extends PersistentConnection {
|
||||||
if (ackMsgIds) {
|
if (ackMsgIds) {
|
||||||
this._session.queuedAcks.splice(0, 0, ...ackMsgIds)
|
this._session.queuedAcks.splice(0, 0, ...ackMsgIds)
|
||||||
}
|
}
|
||||||
this._onMessageFailed(rootMsgId!, 'unknown error')
|
if (rootMsgId) {
|
||||||
|
this._onMessageFailed(rootMsgId, 'unknown error')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,12 +116,12 @@ export abstract class BaseTcpTransport extends EventEmitter implements ITelegram
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(bytes: Uint8Array): Promise<void> {
|
async send(bytes: Uint8Array): Promise<void> {
|
||||||
|
const framed = await this._packetCodec.encode(bytes)
|
||||||
|
|
||||||
if (this._state !== TransportState.Ready) {
|
if (this._state !== TransportState.Ready) {
|
||||||
throw new MtcuteError('Transport is not READY')
|
throw new MtcuteError('Transport is not READY')
|
||||||
}
|
}
|
||||||
|
|
||||||
const framed = await this._packetCodec.encode(bytes)
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this._socket!.write(framed, (error) => {
|
this._socket!.write(framed, (error) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|
Loading…
Reference in a new issue