|
1 | 1 | use crate::{
|
2 |
| - connection::{BaseConnection, Buffer}, |
| 2 | + connection::{BaseConnection, Buffer, InetSocketConnection}, |
3 | 3 | models::{BaseMessage, Value},
|
4 | 4 | protocol::BaseProtocol,
|
5 | 5 | utils::{self, Error, Result},
|
6 | 6 | };
|
7 | 7 |
|
8 | 8 | #[cfg(target_family = "unix")]
|
9 | 9 | use crate::connection::UnixSocketConnection;
|
10 |
| -#[cfg(target_family = "windows")] |
11 |
| -use crate::connection::InetSocketConnection; |
12 | 10 |
|
13 | 11 | use std::collections::HashMap;
|
14 | 12 | use async_std::{
|
@@ -51,10 +49,22 @@ impl GothamModule {
|
51 | 49 | }
|
52 | 50 |
|
53 | 51 | #[cfg(target_family = "windows")]
|
54 |
| - pub fn default(port: String) -> Self { |
| 52 | + pub fn default(port: u16) -> Self { |
55 | 53 | GothamModule {
|
56 | 54 | protocol: BaseProtocol::default(),
|
57 |
| - connection: Box::new(InetSocketConnection::new(port)), |
| 55 | + connection: Box::new(InetSocketConnection::new(format!("127.0.0.1:{}", port))), |
| 56 | + requests: Arc::new(Mutex::new(HashMap::new())), |
| 57 | + functions: Arc::new(Mutex::new(HashMap::new())), |
| 58 | + hook_listeners: Arc::new(Mutex::new(HashMap::new())), |
| 59 | + message_buffer: vec![], |
| 60 | + registered: false, |
| 61 | + } |
| 62 | + } |
| 63 | + |
| 64 | + pub fn with_inet_socket(socket: String) -> Self { |
| 65 | + GothamModule { |
| 66 | + protocol: BaseProtocol::default(), |
| 67 | + connection: Box::new(InetSocketConnection::new(socket)), |
58 | 68 | requests: Arc::new(Mutex::new(HashMap::new())),
|
59 | 69 | functions: Arc::new(Mutex::new(HashMap::new())),
|
60 | 70 | hook_listeners: Arc::new(Mutex::new(HashMap::new())),
|
|
0 commit comments