Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita9468d8

Browse files
committed
feat: add 'close_connection' method in raknet_python
1 parenta291fe8 commita9468d8

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

‎python/raknet/_raknet.pyi‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ class RakPeer:
8989
offline_ping_response:bytes
9090
def__init__(self)->None:
9191
...
92+
defclose_connection(self,target:SystemAddress,send_disconnection_notification:bool,ordering_channel:int=0,disconnection_notification_priority:PacketPriority=PacketPriority.LOW_PRIORITY)->None:
93+
...
9294
defconnect(self,host:str,port:int,num_attempts:int=6,attempt_interval_ms:int=1000,timeout:int=0)->None:
9395
...
9496
defget_bound_address(self,index:int=0)->SystemAddress:
@@ -113,4 +115,9 @@ class RakPeer:
113115
defnum_connections(self)->int:
114116
...
115117

118+
119+
deftime()->float:
120+
...
121+
deftime_ms()->int:
122+
...
116123
# @formatter:on # fmt: on

‎src/raknet_python.cpp‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,23 @@ PYBIND11_MODULE(_raknet, m) {
194194
py::arg("attempt_interval_ms") =1000,
195195
py::arg("timeout") =0)
196196

197+
.def(
198+
"close_connection",
199+
[](RakNet::RakPeerInterface &self,
200+
RakNet::SystemAddress &target,
201+
bool send_disconnection_notification,
202+
int ordering_channel,
203+
PacketPriority disconnection_notification_priority) {
204+
self.CloseConnection(target,
205+
send_disconnection_notification,
206+
static_cast<unsignedchar>(ordering_channel &0xff),
207+
disconnection_notification_priority);
208+
},
209+
py::arg("target"),
210+
py::arg("send_disconnection_notification"),
211+
py::arg("ordering_channel") =0,
212+
py::arg("disconnection_notification_priority") = PacketPriority::LOW_PRIORITY)
213+
197214
.def("receive",
198215
[](RakNet::RakPeerInterface &self) -> std::unique_ptr<Packet> {
199216
auto *p = self.Receive();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp