Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[fix] iocp: reactivated file and UDP handling

  • Loading branch information...
commit 2ec659850f51e610af73ef9d3a3ba527bd510373 1 parent e681f9e
shadinger authored

Showing 1 changed file with 3 additions and 7 deletions. Show diff stats Hide diff stats

  1. 10  appruntime/connection.ml
10  appruntime/connection.ml
@@ -70,9 +70,9 @@ let write conn ?(pos=0) buf len =
70 70
 #<Ifstatic:OS Win.*>
71 71
 let write_async_WINDOWS conn buf len =
72 72
   match NA.get_type_and_fd conn with
73  
-    | `File _fd -> assert false (* Unix.write fd buf pos len *)
  73
+    | `File fd -> Iocp.async_write fd buf len
74 74
     | `Tcp fd -> Iocp.async_write fd buf len
75  
-    | `Udp _fd -> assert false (* Unix.sendto fd buf pos len [] (Unix.getpeername fd) *)
  75
+    | `Udp fd -> Iocp.async_write_to fd buf len (Unix.getpeername fd)
76 76
     | `Ssl _s -> assert false (* Ssl.write s buf pos len *)
77 77
 
78 78
 let write_status_WINDOWS conn =
@@ -81,7 +81,7 @@ let write_status_WINDOWS conn =
81 81
   if nread = 0 then -1
82 82
   else nread
83 83
 
84  
-  let write_to_async_WINDOWS conn addr buf len =
  84
+let write_to_async_WINDOWS conn addr buf len =
85 85
   match NA.get_type_and_fd conn with
86 86
   | `Udp fd -> Iocp.async_write_to fd buf len addr
87 87
   | _ -> failwith "[Connection] write_to used on a non-UDP socket"
@@ -146,7 +146,6 @@ let read conn =
146 146
 
147 147
 #<Ifstatic:OS Win.*>
148 148
 let read_async_WINDOWS ?(to_read=read_buff_length) conn =
149  
-  (* Logger.error "read_async_WINDOWS(%d)" (Iocp.int_of_filedescr (NA.get_fd conn)); *)
150 149
   Iocp.async_read (NA.get_fd conn) to_read
151 150
 
152 151
 let read_from_buffer_WINDOWS conn =
@@ -168,10 +167,8 @@ let read_more_buffer_WINDOWS conn buf =
168 167
   nread, buf
169 168
   
170 169
 let read_buffer_WINDOWS conn =
171  
-  (* Logger.error "read_buffer_WINDOWS(%d)" (Iocp.int_of_filedescr (NA.get_fd conn)); *)
172 170
   let buf = Iocp.get_last_buffer (NA.get_fd conn) in
173 171
   let nread = String.length buf in
174  
-  (* Logger.error "read_buffer_WINDOWS nread=%d" nread; *)
175 172
   nread, buf
176 173
 
177 174
 let read_more2_buffer_WINDOWS conn buf_in =
@@ -223,7 +220,6 @@ let connect ?(socket_type = TCP) ?socket_flags addr =
223 220
   try
224 221
     begin
225 222
       try Iocp.async_connect sock addr
226  
-        (* Use iocp to be warned when connect is finished *)
227 223
       with Unix.Unix_error (Unix.EINPROGRESS, _, _) -> ()
228 224
     end;
229 225
     sock

0 notes on commit 2ec6598

Please sign in to comment.
Something went wrong with that request. Please try again.