Commit 2fef04acf8102579b7f7c977216a7138559c753d

Authored by perry.werneck@gmail.com
1 parent 5f125de3
Exists in master and in 1 other branch develop

Processo de conexao instavel em windows, tentando mudar para select para ver se melhora

Showing 1 changed file with 4 additions and 33 deletions   Show diff stats
iocallback.c
... ... @@ -46,13 +46,8 @@
46 46 static int static_CallAndWait(int(*callback)(H3270 *session, void *), H3270 *session, void *parm);
47 47 static void static_RemoveSource(void *id);
48 48  
49   -#ifdef WIN32
50   -static void * static_AddInput(HANDLE source, H3270 *session, void (*fn)(H3270 *session));
51   -static void * static_AddExcept(HANDLE source, H3270 *session, void (*fn)(H3270 *session));
52   -#else
53 49 static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session));
54 50 static void * static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *session));
55   -#endif // WIN32
56 51  
57 52 static void * static_AddTimeOut(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session));
58 53 static void static_RemoveTimeOut(void * timer);
... ... @@ -71,11 +66,7 @@ static gboolean IO_closure(gpointer data);
71 66 {
72 67 GSource gsrc;
73 68 GPollFD poll;
74   -#if defined(_WIN32)
75   - HANDLE source;
76   -#else
77 69 int source;
78   -#endif // WIN32
79 70 void (*fn)(H3270 *session);
80 71 H3270 *session;
81 72 } IO_Source;
... ... @@ -99,11 +90,7 @@ static gboolean IO_closure(gpointer data);
99 90  
100 91 /*---[ Implement ]-----------------------------------------------------------------------------------------*/
101 92  
102   -#ifdef WIN32
103   -static void * AddSource(HANDLE source, H3270 *session, gushort events, void (*fn)(H3270 *session))
104   -#else
105 93 static void * AddSource(int source, H3270 *session, gushort events, void (*fn)(H3270 *session))
106   -#endif // WIN32
107 94 {
108 95 IO_Source *src = (IO_Source *) g_source_new(&IOSources,sizeof(IO_Source));
109 96  
... ... @@ -119,21 +106,13 @@ static void * AddSource(int source, H3270 *session, gushort events, void (*fn)(H
119 106 return src;
120 107 }
121 108  
122   -#ifdef WIN32
123   -static void * static_AddOutput(HANDLE source, H3270 *session, void (*fn)(H3270 *session))
124   -#else
125 109 static void * static_AddOutput(int source, H3270 *session, void (*fn)(H3270 *session))
126   -#endif // WIN32
127 110 {
128 111 return AddSource(source,session,G_IO_OUT|G_IO_HUP|G_IO_ERR,fn);
129 112 }
130 113  
131 114  
132   -#ifdef WIN32
133   -static void * static_AddInput(HANDLE source, H3270 *session, void (*fn)(H3270 *session))
134   -#else
135 115 static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session))
136   -#endif // WIN32
137 116 {
138 117 return AddSource(source,session,G_IO_IN|G_IO_HUP|G_IO_ERR,fn);
139 118 }
... ... @@ -144,17 +123,10 @@ static void static_RemoveSource(void *id)
144 123 g_source_destroy((GSource *) id);
145 124 }
146 125  
147   -#if defined(WIN32)
148   -static void * static_AddExcept(HANDLE source, H3270 *session, void (*fn)(H3270 *session))
149   -{
150   - return 0;
151   -}
152   -#else
153 126 static void * static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *session))
154 127 {
155 128 return AddSource(source,session,G_IO_HUP|G_IO_ERR,fn);
156 129 }
157   -#endif // WIN32
158 130  
159 131 static gboolean do_timer(TIMER *t)
160 132 {
... ... @@ -208,12 +180,11 @@ static gboolean IO_check(GSource *source)
208 180 * function was called, so the source should be checked again here.
209 181 *
210 182 */
211   -#if defined(_WIN32) /*[*/
  183 +#ifdef _WIN32
212 184  
213   - if(WaitForSingleObject(((IO_Source *) source)->source,0) == WAIT_OBJECT_0)
214   - return TRUE;
  185 + #error AQUI
215 186  
216   -#else /*][*/
  187 +#else
217 188  
218 189 struct pollfd fds;
219 190  
... ... @@ -225,7 +196,7 @@ static gboolean IO_check(GSource *source)
225 196 if(poll(&fds,1,0) > 0)
226 197 return TRUE;
227 198  
228   -#endif /*]*/
  199 +#endif // _WIN32
229 200  
230 201 return FALSE;
231 202 }
... ...