Pārlūkot izejas kodu

Move packet types from packet_connection to packet.

Mathias Gottschlag 5 gadus atpakaļ
vecāks
revīzija
a7131f9236
4 mainītis faili ar 22 papildinājumiem un 21 dzēšanām
  1. 12
    12
      src/network/client.rs
  2. 1
    1
      src/network/mod.rs
  3. 6
    6
      src/network/packet.rs
  4. 3
    2
      src/network/server.rs

+ 12
- 12
src/network/client.rs Parādīt failu

@@ -1,11 +1,11 @@
1 1
 use futures::Future;
2
-use futures::task::{Context, Poll};
3
-use core::pin::Pin;
2
+//use futures::task::{Context, Poll};
3
+//use core::pin::Pin;
4 4
 use tokio::stream::Stream;
5
-use async_tungstenite::{tokio::connect_async, tungstenite::Message, WebSocketStream};
6
-use url::Url;
5
+//use async_tungstenite::{tokio::connect_async, tungstenite::Message, WebSocketStream};
6
+//use url::Url;
7 7
 
8
-use super::packet_connection::IncomingPacket;
8
+use super::packet::IncomingPacket;
9 9
 
10 10
 use std::time::Duration;
11 11
 
@@ -23,14 +23,14 @@ pub trait RPC: Future {
23 23
 
24 24
 pub trait ServerEventStream<PacketType>: Stream<Item = PacketType> {}
25 25
 
26
-pub struct WSRPCInterface<PacketType, Stream> {
26
+/*pub struct WSRPCInterface<PacketType, Stream> {
27 27
     // TODO
28 28
     _unused: PacketType,
29 29
     stream: WebSocketStream<Stream>,
30 30
 }
31 31
 
32 32
 impl<P, S> WSRPCInterface<P, S> {
33
-    fn create<P2, S2>(ws_stream: WebSocketStream<S2>) -> (Self, WSServerEventStream<P2>) {
33
+    fn create<P2, S2>(_ws_stream: WebSocketStream<S2>) -> (Self, WSServerEventStream<P2>) {
34 34
         // TODO
35 35
         panic!("Not yet implemented.");
36 36
     }
@@ -80,11 +80,11 @@ impl<P> Stream for WSServerEventStream<P> {
80 80
         // TODO
81 81
         panic!("Not yet implemented.");
82 82
     }
83
-}
84
-
83
+}*/
85 84
 
86
-pub async fn low_level_integration_test_client(address: String) {
87
-    let url = Url::parse(&address).unwrap();
88
-    let (mut ws_stream, _) = connect_async(url).await.unwrap();
85
+pub async fn low_level_integration_test_client(_address: String) {
86
+    //let url = Url::parse(&address).unwrap();
87
+    //let (mut ws_stream, _) = connect_async(url).await.unwrap();
89 88
     // TODO
89
+    panic!("Not yet implemented.");
90 90
 }

+ 1
- 1
src/network/mod.rs Parādīt failu

@@ -1,3 +1,3 @@
1 1
 pub mod client;
2
-pub mod packet_connection;
2
+pub mod packet;
3 3
 pub mod server;

src/network/packet_connection.rs → src/network/packet.rs Parādīt failu

@@ -27,16 +27,16 @@
27 27
 //! a way that no such temporal information is necessary to process the events.
28 28
 //! TODO: Example to demonstrate the problem.
29 29
 
30
-use serde::de::DeserializeOwned;
30
+//use futures::sink::Sink;
31
+//use futures::stream::Stream;
32
+//use serde::de::DeserializeOwned;
31 33
 use serde::{Deserialize, Serialize};
32 34
 
33 35
 pub const SERVER_EVENT_ID: u32 = u32::max_value();
34 36
 
35
-pub trait PacketConnection {
36
-    type Payload: Serialize + DeserializeOwned;
37
-
38
-    // TODO
39
-}
37
+//pub trait PacketConnection: Sink<&Self::Payload> + Stream<IncomingPacket<Payload>> {
38
+//    type Payload: Serialize + DeserializeOwned;
39
+//}
40 40
 
41 41
 /// Type which holds a byte vector received via the network and which allows access to the
42 42
 /// deserialized packet.

+ 3
- 2
src/network/server.rs Parādīt failu

@@ -1,4 +1,4 @@
1
-use super::packet_connection::IncomingPacket;
1
+use super::packet::IncomingPacket;
2 2
 
3 3
 // Trait that is implemented by any RPC server to process incoming calls.
4 4
 trait RPCServer {
@@ -27,7 +27,7 @@ pub struct LowLevelIntegrationTestServer {
27 27
 }
28 28
 
29 29
 impl LowLevelIntegrationTestServer {
30
-    pub async fn start(bind_address: &str) -> LowLevelIntegrationTestServer {
30
+    pub async fn start(_bind_address: &str) -> LowLevelIntegrationTestServer {
31 31
         // TODO
32 32
         LowLevelIntegrationTestServer{}
33 33
     }
@@ -36,3 +36,4 @@ impl LowLevelIntegrationTestServer {
36 36
         // TODO
37 37
     }
38 38
 }
39
+

Notiek ielāde…
Atcelt
Saglabāt