--- a/project_files/frontlib/ipc.c Mon Jun 04 21:12:20 2012 +0200
+++ b/project_files/frontlib/ipc.c Thu Jun 07 02:45:18 2012 +0200
@@ -155,11 +155,12 @@
return;
}
- flib_ipcconn_tick(ipc->connection);
- IpcConnState newstate = flib_ipcconn_state(ipc->connection);
- if(ipc->oldConnState == IPC_LISTENING && newstate == IPC_CONNECTED) {
- ipc->oldConnState = newstate;
- ipc->onConnectCb(ipc->onConnectCtx);
+ if(ipc->oldConnState == IPC_LISTENING) {
+ flib_ipcconn_accept(ipc->connection);
+ if(flib_ipcconn_state(ipc->connection) == IPC_CONNECTED) {
+ ipc->oldConnState = IPC_CONNECTED;
+ ipc->onConnectCb(ipc->onConnectCtx);
+ }
}
if(ipc->oldConnState == IPC_CONNECTED) {
@@ -216,13 +217,31 @@
}
}
- newstate = flib_ipcconn_state(ipc->connection);
- if(newstate == IPC_NOT_CONNECTED) {
- ipc->oldConnState = newstate;
+ if(flib_ipcconn_state(ipc->connection) == IPC_NOT_CONNECTED) {
+ ipc->oldConnState = IPC_NOT_CONNECTED;
ipc->onDisconnectCb(ipc->onDisconnectCtx);
}
}
+void flib_ipc_tick(flib_ipc ipc) {
+ if(!ipc) {
+ flib_log_w("Call to flib_ipc_tick with ipc==null");
+ return;
+ }
+ if(ipc->running) {
+ flib_log_w("Call to flib_ipc_tick from a callback");
+ return;
+ }
+
+ ipc->running = true;
+ flib_ipc_wrappedtick(ipc);
+ ipc->running = false;
+
+ if(ipc->destroyRequested) {
+ flib_ipc_destroy(&ipc);
+ }
+}
+
int flib_ipc_send_raw(flib_ipc ipc, void *data, size_t len) {
if(!ipc) {
flib_log_w("Call to flib_ipc_send_raw with ipc==null");
@@ -261,24 +280,5 @@
flib_constbuffer result = {NULL, 0};
return result;
}
- return flib_ipcconn_getdemo(ipc->connection);
+ return flib_ipcconn_getrecord(ipc->connection, false);
}
-
-void flib_ipc_tick(flib_ipc ipc) {
- if(!ipc) {
- flib_log_w("Call to flib_ipc_tick with ipc==null");
- return;
- }
- if(ipc->running) {
- flib_log_w("Call to flib_ipc_tick from a callback");
- return;
- }
-
- ipc->running = true;
- flib_ipc_wrappedtick(ipc);
- ipc->running = false;
-
- if(ipc->destroyRequested) {
- flib_ipc_destroy(&ipc);
- }
-}