My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 21 attachment: std_cpp_net.patch (2.7 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Только в /usr/lib/haxe: lib
diff -rc ./std/cpp/net/Socket.hx /usr/lib/haxe/std/cpp/net/Socket.hx
*** ./std/cpp/net/Socket.hx 2010-01-09 22:12:13.000000000 +0300
--- /usr/lib/haxe/std/cpp/net/Socket.hx 2010-03-22 10:14:09.000000000 +0300
***************
*** 120,130 ****

// STATICS
public static function select(read : Array<Socket>, write : Array<Socket>, others : Array<Socket>, timeout : Float) : {read: Array<Socket>,write: Array<Socket>,others: Array<Socket>} {
! var neko_array = socket_select(read,write,others, timeout);
return {
! read: neko_array[0],
! write: neko_array[1],
! others: neko_array[2]
};
}

--- 120,148 ----

// STATICS
public static function select(read : Array<Socket>, write : Array<Socket>, others : Array<Socket>, timeout : Float) : {read: Array<Socket>,write: Array<Socket>,others: Array<Socket>} {
! var f = function(sa:Array<Socket>) {
! if (sa == null)
! return null;
! var ra = new Array<SocketHandle>();
! for (sock in sa)
! ra.push(sock.__s);
! return ra;
! }
! var g = function(ra:Array<SocketHandle>, inarray:Array<Socket>) {
! if (ra == null)
! return null;
! var sa = new Array<Socket>();
! for (handle in ra)
! for (sock in inarray)
! if (sock.__s == handle)
! sa.push(sock);
! return sa;
! }
! var neko_array = socket_select(f(read),f(write),f(others), timeout);
return {
! read: g(neko_array[0], read),
! write: g(neko_array[1], write),
! others: g(neko_array[2], others)
};
}

diff -rc ./std/cpp/net/SocketInput.hx /usr/lib/haxe/std/cpp/net/SocketInput.hx
*** ./std/cpp/net/SocketInput.hx 2010-01-09 22:12:13.000000000 +0300
--- /usr/lib/haxe/std/cpp/net/SocketInput.hx 2010-03-22 10:10:01.000000000 +0300
***************
*** 35,40 ****
--- 35,42 ----
}

public override function readByte() {
+ if (__s == null)
+ throw "Invalid handle";
return try {
socket_recv_char(__s);
} catch( e : Dynamic ) {
diff -rc ./std/cpp/net/SocketOutput.hx /usr/lib/haxe/std/cpp/net/SocketOutput.hx
*** ./std/cpp/net/SocketOutput.hx 2010-01-09 22:12:13.000000000 +0300
--- /usr/lib/haxe/std/cpp/net/SocketOutput.hx 2010-03-22 10:15:40.000000000 +0300
***************
*** 35,40 ****
--- 35,42 ----
}

public override function writeByte( c : Int ) {
+ if (__s == null)
+ throw "Invalid handle";
try {
socket_send_char(__s, c);
} catch( e : Dynamic ) {
***************
*** 46,51 ****
--- 48,55 ----
}

public override function writeBytes( buf : haxe.io.Bytes, pos : Int, len : Int) : Int {
+ if (__s == null)
+ throw "Invalid handle";
return try {
socket_send(__s, buf.getData(), pos, len);
} catch( e : Dynamic ) {
Powered by Google Project Hosting