Commit 12390c2c authored by Jonathan Michalon's avatar Jonathan Michalon

Few enhancements reading infos from valac

parent 97212e02
......@@ -95,27 +95,6 @@ namespace OVCC.Network
return message;
}
public static async Message receive_async (DataInputStream stream,
Cancellable? cancel = null)
throws Error
{
Message result = null;
Error? err = null;
Thread.create<void> (() => {
try {
result = Message.receive (stream, cancel);
} catch (Error e) {
err = e;
}
Idle.add (receive_async.callback);
}, false);
yield;
if (err != null) {
throw err;
}
return result;
}
public bool send (DataOutputStream stream,
Cancellable? cancel = null)
throws Error
......@@ -124,27 +103,6 @@ namespace OVCC.Network
this.serialize (stream, cancel);
return true;
}
public async bool send_async (DataOutputStream stream,
Cancellable? cancel = null)
throws Error
{
bool result = true;
Error? err = null;
Thread.create<void> (() => {
try {
result = this.send (stream, cancel);
} catch (Error e) {
err = e;
}
Idle.add (send_async.callback);
}, false);
yield;
if (err != null) {
throw err;
}
return result;
}
protected uint8[] read_buffer (DataInputStream stream,
Cancellable? cancel = null)
......@@ -156,13 +114,11 @@ namespace OVCC.Network
len);
}
var buf = new uint8[len];
if (len > 0) {
var buf = new uint8[len];
stream.read (buf, cancel);
return buf;
} else {
return null;
}
return buf;
}
protected bool write_buffer (DataOutputStream stream,
......
......@@ -73,6 +73,7 @@ namespace OVCC
* A class providing the description of a Game.
* This is a stripped-down group of data typically to descibe a Game over network.
*/
[Compact]
public class GameDescription : Object
{
public string name { get; construct; }
......
......@@ -19,8 +19,8 @@
*/
static const int N_NORMAL = 7;
static const int N_DOUBLE = 1;
const int N_NORMAL = 7;
const int N_DOUBLE = 1;
namespace OVCC
......
......@@ -18,7 +18,6 @@
*
*/
[compact]
public class OVCC.SigQueue
{
private struct Entry {
......
......@@ -318,9 +318,9 @@ namespace OVCCClient
output = new DataOutputStream (connection.output_stream);
listen_loop_cancel = new Cancellable ();
send_loop_cancel = new Cancellable ();
listen_loop_thread = Thread.create<bool> (listen_loop, true);
listen_loop_thread = new Thread<bool>.try ("listen loop", listen_loop);
send_loop_running = 1;
send_loop_thread = Thread.create<bool> (send_loop, true);
send_loop_thread = new Thread<bool>.try ("send loop", send_loop);
} catch (IOError.CANCELLED c) {
throw c;
} catch (Error e) {
......
......@@ -21,8 +21,8 @@
using OVCC;
using OVCC.Network;
static const string TILES_FILE = "tiles.xml";
static const string TILESET_FILE = "tileset.xml";
const string TILES_FILE = "tiles.xml";
const string TILESET_FILE = "tileset.xml";
/* TODO: add a Source to be notified of incoming messages asynchronously */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment