Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
8308e684
Commit
8308e684
authored
Oct 28, 2019
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename UninitializedByteReadPacket as Uninitialized
parent
d8e1c875
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network/protocol/tim/packet/OutgoingPacket.kt
...mamoe.mirai/network/protocol/tim/packet/OutgoingPacket.kt
+9
-4
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network/protocol/tim/packet/OutgoingPacket.kt
View file @
8308e684
...
...
@@ -26,15 +26,16 @@ abstract class OutgoingPacket : Packet(), Closeable {
companion
object
{
@JvmStatic
private
val
sequenceIdInternal
=
atomic
(
1
)
internal
fun
atomicNextSequenceId
()
=
sequenceIdInternal
.
getAndIncrement
().
toUShort
()
}
/**
* 务必 [ByteReadPacket.close] 或 [close] 或使用 [Closeable.use]
*/
var
packet
:
ByteReadPacket
=
Uninitialized
ByteReadPacket
var
packet
:
ByteReadPacket
=
Uninitialized
get
()
{
if
(
field
===
Uninitialized
ByteReadPacket
)
build
()
if
(
field
===
Uninitialized
)
build
()
return
field
}
private
set
...
...
@@ -52,7 +53,11 @@ abstract class OutgoingPacket : Packet(), Closeable {
override
fun
toString
():
String
=
packetToString
()
override
fun
close
()
=
if
(
this
.
packet
===
UninitializedByteReadPacket
)
Unit
else
this
.
packet
.
close
()
override
fun
close
()
{
if
(
this
.
packet
!==
Uninitialized
)
{
this
.
packet
.
close
()
}
}
private
fun
BytePacketBuilder
.
writePacketId
()
{
writeUShort
(
this
@OutgoingPacket
.
id
)
...
...
@@ -66,4 +71,4 @@ abstract class OutgoingPacket : Packet(), Closeable {
@Retention
(
AnnotationRetention
.
SOURCE
)
annotation
class
PacketVersion
(
val
date
:
String
,
val
timVersion
:
String
)
private
val
Uninitialized
ByteReadPacket
=
ByteReadPacket
(
IoBuffer
.
Empty
,
IoBuffer
.
EmptyPool
)
private
val
Uninitialized
=
ByteReadPacket
(
IoBuffer
.
Empty
,
IoBuffer
.
EmptyPool
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment