@@ -17,7 +17,7 @@ defmodule Mongo.MongoDBConnection do
17
17
write_concern = Keyword . put_new ( write_concern , :w , 1 )
18
18
19
19
state = % {
20
- socket : nil ,
20
+ connection : nil ,
21
21
request_id: 0 ,
22
22
timeout: opts [ :timeout ] || @ timeout ,
23
23
connect_timeout_ms: opts [ :connect_timeout_ms ] || @ timeout ,
@@ -34,9 +34,9 @@ defmodule Mongo.MongoDBConnection do
34
34
end
35
35
36
36
@ impl true
37
- def disconnect ( _error , % { socket : { mod , sock } } = state ) do
37
+ def disconnect ( _error , % { connection : { mod , socket } } = state ) do
38
38
notify_disconnect ( state )
39
- mod . close ( sock )
39
+ mod . close ( socket )
40
40
end
41
41
42
42
defp notify_disconnect ( % { connection_type: type , topology_pid: pid , host: host } ) do
@@ -64,8 +64,8 @@ defmodule Mongo.MongoDBConnection do
64
64
{ :tcp_send , reason } -> Mongo.Error . exception ( tag: :tcp , action: "send" , reason: reason , host: state . host )
65
65
% Mongo.Error { } = reason -> reason
66
66
end
67
- { mod , sock } = state . socket
68
- mod . close ( sock )
67
+ { mod , socket } = state . connection
68
+ mod . close ( socket )
69
69
{ :error , reason }
70
70
71
71
{ :error , reason } -> { :error , reason }
@@ -82,13 +82,13 @@ defmodule Mongo.MongoDBConnection do
82
82
defp maybe_ssl ( opts , % { ssl: true } = state ) , do: ssl ( opts , state )
83
83
defp maybe_ssl ( _opts , state ) , do: { :ok , state }
84
84
85
- defp ssl ( opts , % { socket : { :gen_tcp , sock } } = state ) do
85
+ defp ssl ( opts , % { connection : { :gen_tcp , socket } } = state ) do
86
86
host = ( opts [ :hostname ] || "localhost" ) |> to_charlist
87
87
ssl_opts = Keyword . put_new ( opts [ :ssl_opts ] || [ ] , :server_name_indication , host )
88
- case :ssl . connect ( sock , ssl_opts , state . connect_timeout_ms ) do
89
- { :ok , ssl_sock } -> { :ok , % { state | socket : { :ssl , ssl_sock } } }
88
+ case :ssl . connect ( socket , ssl_opts , state . connect_timeout_ms ) do
89
+ { :ok , ssl_sock } -> { :ok , % { state | connection : { :ssl , ssl_sock } } }
90
90
{ :error , reason } ->
91
- :gen_tcp . close ( sock )
91
+ :gen_tcp . close ( socket )
92
92
{ :error , Mongo.Error . exception ( tag: :ssl , action: "connect" , reason: reason , host: state . host ) }
93
93
end
94
94
end
@@ -109,7 +109,7 @@ defmodule Mongo.MongoDBConnection do
109
109
buffer = buffer |> max ( sndbuf ) |> max ( recbuf )
110
110
:ok = :inet . setopts ( socket , buffer: buffer )
111
111
112
- { :ok , % { s | socket : { :gen_tcp , socket } } }
112
+ { :ok , % { s | connection : { :gen_tcp , socket } } }
113
113
114
114
{ :error , reason } -> { :error , Mongo.Error . exception ( tag: :tcp , action: "connect" , reason: reason , host: s . host ) }
115
115
end
@@ -134,23 +134,23 @@ defmodule Mongo.MongoDBConnection do
134
134
def checkin ( state ) , do: { :ok , state }
135
135
136
136
@ impl true
137
- def handle_begin ( opts , state ) , do: { :ok , nil , state }
137
+ def handle_begin ( _opts , state ) , do: { :ok , nil , state }
138
138
@ impl true
139
- def handle_close ( query , opts , state ) , do: { :ok , nil , state }
139
+ def handle_close ( _query , _opts , state ) , do: { :ok , nil , state }
140
140
@ impl true
141
- def handle_commit ( opts , state ) , do: { :ok , nil , state }
141
+ def handle_commit ( _opts , state ) , do: { :ok , nil , state }
142
142
@ impl true
143
- def handle_deallocate ( query , cursor , opts , state ) , do: { :ok , nil , state }
143
+ def handle_deallocate ( _query , _cursor , _opts , state ) , do: { :ok , nil , state }
144
144
@ impl true
145
- def handle_declare ( query , params , opts , state ) , do: { :ok , query , nil , state }
145
+ def handle_declare ( query , _params , _opts , state ) , do: { :ok , query , nil , state }
146
146
@ impl true
147
- def handle_fetch ( query , cursor , opts , state ) , do: { :halt , nil , state }
147
+ def handle_fetch ( _query , _cursor , _opts , state ) , do: { :halt , nil , state }
148
148
@ impl true
149
- def handle_prepare ( query , opts , state ) , do: { :ok , query , state }
149
+ def handle_prepare ( query , _opts , state ) , do: { :ok , query , state }
150
150
@ impl true
151
- def handle_rollback ( opts , state ) , do: { :ok , nil , state }
151
+ def handle_rollback ( _opts , state ) , do: { :ok , nil , state }
152
152
@ impl true
153
- def handle_status ( opts , state ) , do: { :idle , state }
153
+ def handle_status ( _opts , state ) , do: { :idle , state }
154
154
155
155
@ impl true
156
156
def ping ( % { wire_version: wire_version } = state ) do
0 commit comments