Commit af2192d3be18f3e093e1ed514e783481e9a46c6e

Authored by Perry Werneck
1 parent 9c1b63e1
Exists in master and in 1 other branch develop

Working on windows IPC module.

Showing 2 changed files with 15 additions and 11 deletions   Show diff stats
src/windows/gobject.h
... ... @@ -68,7 +68,7 @@
68 68 GSource gsrc;
69 69 HANDLE hPipe;
70 70  
71   - enum PIPE_STATE state;
  71 + IPC3270_PIPE_STATE state;
72 72  
73 73 OVERLAPPED overlap;
74 74 unsigned char buffer[PIPE_BUFFER_LENGTH+1];
... ...
src/windows/pipesource.c
... ... @@ -68,7 +68,7 @@ static gboolean IO_prepare(GSource *source, gint *timeout) {
68 68 * returned which were >= 0.
69 69 *
70 70 */
71   - if(WaitForSingleObject(((pipe_source *) source)->overlap.hEvent,0) == WAIT_OBJECT_0)
  71 + if(WaitForSingleObject(((IPC3270_PIPE_SOURCE *) source)->overlap.hEvent,0) == WAIT_OBJECT_0)
72 72 return TRUE;
73 73  
74 74 *timeout = 10;
... ... @@ -155,15 +155,15 @@ static gboolean IO_dispatch(GSource *source, GSourceFunc callback, gpointer data
155 155 BOOL fSuccess;
156 156 DWORD cbRead = 0;
157 157  
158   - fSuccess = GetOverlappedResult(((pipe_source *) source)->hPipe,&((pipe_source *) source)->overlap,&cbRead,FALSE );
  158 + fSuccess = GetOverlappedResult(((IPC3270_PIPE_SOURCE *) source)->hPipe,&((IPC3270_PIPE_SOURCE *) source)->overlap,&cbRead,FALSE );
159 159  
160   - switch(((pipe_source *) source)->state) {
  160 + switch(((IPC3270_PIPE_SOURCE *) source)->state) {
161 161 case PIPE_STATE_WAITING:
162 162  
163 163 if(fSuccess) {
164 164  
165 165 g_message("Client is connected");
166   - ((pipe_source *) source)->state = PIPE_STATE_READ;
  166 + ((IPC3270_PIPE_SOURCE *) source)->state = PIPE_STATE_READ;
167 167  
168 168 } else {
169 169  
... ... @@ -174,13 +174,13 @@ static gboolean IO_dispatch(GSource *source, GSourceFunc callback, gpointer data
174 174  
175 175 case PIPE_STATE_READ:
176 176 // trace("Reading pipe (cbRead=%d)",(int) cbRead);
177   - read_input_pipe( (pipe_source *) source);
  177 + read_input_pipe( (IPC3270_PIPE_SOURCE *) source);
178 178 break;
179 179  
180 180 case PIPE_STATE_PENDING_READ:
181 181 if(fSuccess && cbRead > 0)
182   - process_input((pipe_source *) source,cbRead);
183   - ((pipe_source *) source)->state = PIPE_STATE_READ;
  182 + process_input((IPC3270_PIPE_SOURCE *) source,cbRead);
  183 + ((IPC3270_PIPE_SOURCE *) source)->state = PIPE_STATE_READ;
184 184 break;
185 185  
186 186 case PIPE_STATE_UNDEFINED:
... ... @@ -191,11 +191,15 @@ static gboolean IO_dispatch(GSource *source, GSourceFunc callback, gpointer data
191 191 return TRUE;
192 192 }
193 193  
  194 +static gboolean IO_closure(gpointer data) {
  195 + return 0;
  196 +}
  197 +
194 198 static void IO_finalize(GSource *source) {
195 199  
196   - if( ((pipe_source *) source)->hPipe != INVALID_HANDLE_VALUE) {
197   - CloseHandle(((pipe_source *) source)->hPipe);
198   - ((pipe_source *) source)->hPipe = INVALID_HANDLE_VALUE;
  200 + if( ((IPC3270_PIPE_SOURCE *) source)->hPipe != INVALID_HANDLE_VALUE) {
  201 + CloseHandle(((IPC3270_PIPE_SOURCE *) source)->hPipe);
  202 + ((IPC3270_PIPE_SOURCE *) source)->hPipe = INVALID_HANDLE_VALUE;
199 203 }
200 204  
201 205 }
... ...