Commit d37b22f7dbf93089b206284e56f6420265d6e734
1 parent
681143c5
Exists in
master
and in
1 other branch
Fixing small bugs on windows.
Showing
7 changed files
with
45 additions
and
19 deletions
Show diff stats
client/src/session/remote/wait.cc
... | ... | @@ -57,16 +57,17 @@ |
57 | 57 | |
58 | 58 | rc = worker(); |
59 | 59 | |
60 | - debug("rc=",rc); | |
60 | + debug("rc=",rc," (",strerror(rc),")"); | |
61 | 61 | |
62 | 62 | if(rc == 0) |
63 | 63 | return; |
64 | - else if(rc != ETIMEDOUT) | |
64 | + | |
65 | + if(rc != ETIMEDOUT) | |
65 | 66 | chkResponse(rc); |
66 | 67 | |
67 | 68 | } |
68 | 69 | |
69 | - chkResponse(ETIMEDOUT); | |
70 | + throw runtime_error("Timeout"); | |
70 | 71 | |
71 | 72 | } |
72 | 73 | |
... | ... | @@ -196,7 +197,7 @@ |
196 | 197 | .call() |
197 | 198 | .pop(rc); |
198 | 199 | |
199 | - debug("rc=",rc); | |
200 | + debug("waitForStringAt rc=",rc); | |
200 | 201 | return rc; |
201 | 202 | |
202 | 203 | }); | ... | ... |
client/src/session/remote/windows/session.cc
... | ... | @@ -77,7 +77,10 @@ |
77 | 77 | ); |
78 | 78 | |
79 | 79 | if (hPipe == INVALID_HANDLE_VALUE) { |
80 | - throw std::runtime_error("Can't open IPC Channel"); | |
80 | + string msg = "Can't open IPC Channel \""; | |
81 | + msg += pipename; | |
82 | + msg += "\""; | |
83 | + throw std::runtime_error(msg); | |
81 | 84 | } |
82 | 85 | |
83 | 86 | // The pipe connected; change to message-read mode. | ... | ... |
server/src/core/windows/gobject.h
... | ... | @@ -90,10 +90,10 @@ |
90 | 90 | GObjectClass parent; |
91 | 91 | }; |
92 | 92 | |
93 | - G_GNUC_INTERNAL GSourceFuncs ipc3270_source_funcs; | |
93 | + G_GNUC_INTERNAL GSourceFuncs * ipc3270_get_source_funcs(); | |
94 | 94 | |
95 | - G_GNUC_INTERNAL void ipc3270_release_object(ipc3270 *object); | |
96 | - G_GNUC_INTERNAL void ipc3270_wait_for_client(IPC3270_PIPE_SOURCE *source); | |
95 | + G_GNUC_INTERNAL void ipc3270_release_object(ipc3270 *object); | |
96 | + G_GNUC_INTERNAL void ipc3270_wait_for_client(IPC3270_PIPE_SOURCE *source); | |
97 | 97 | |
98 | 98 | G_END_DECLS |
99 | 99 | ... | ... |
server/src/core/windows/inout.c
... | ... | @@ -46,6 +46,8 @@ unsigned char * ipc3270_pack_error(const GError *error, size_t * szPacket) { |
46 | 46 | |
47 | 47 | static const char * error_response = "error"; |
48 | 48 | |
49 | + debug("%s(%d,%s)",__FUNCTION__,(int) error_response,error->message); | |
50 | + | |
49 | 51 | *szPacket = strlen(error_response) + 1 + (sizeof(guint16) * 2) + strlen(error->message); |
50 | 52 | |
51 | 53 | // Allocate buffer |
... | ... | @@ -94,40 +96,54 @@ unsigned char * pack_value(unsigned char *txtptr, GVariant *value) { |
94 | 96 | strcpy((char *) txtptr,g_variant_get_string(value,NULL)); |
95 | 97 | txtptr += (strlen((char *) txtptr)+1); |
96 | 98 | |
99 | + debug("%s(%s)",__FUNCTION__,g_variant_get_string(value,NULL)); | |
100 | + | |
97 | 101 | } else if(g_variant_type_equal(type,G_VARIANT_TYPE_BOOLEAN)) { |
98 | 102 | |
99 | 103 | *(txtptr++) = 'b'; |
100 | 104 | *(txtptr++) = g_variant_get_boolean(value) ? 1 : 0; |
101 | 105 | |
106 | + debug("%s(%s)",__FUNCTION__,g_variant_get_boolean(value) ? "True" : "False"); | |
107 | + | |
102 | 108 | } else if(g_variant_type_equal(type,G_VARIANT_TYPE_BYTE)) { |
103 | 109 | |
104 | 110 | *(txtptr++) = 'y'; |
105 | 111 | *(txtptr++) = g_variant_get_byte(value); |
106 | 112 | |
113 | + debug("%s(%d)",__FUNCTION__,(int) g_variant_get_byte(value)); | |
114 | + | |
107 | 115 | } else if(g_variant_type_equal(type,G_VARIANT_TYPE_INT16)) { |
108 | 116 | |
109 | 117 | *(txtptr++) = 'n'; |
110 | 118 | *((gint16 *) txtptr) = g_variant_get_int16(value); |
111 | 119 | txtptr += sizeof(gint16); |
112 | 120 | |
121 | + debug("%s(%d)",__FUNCTION__,(int) g_variant_get_int16(value)); | |
122 | + | |
113 | 123 | } else if(g_variant_type_equal(type,G_VARIANT_TYPE_UINT16)) { |
114 | 124 | |
115 | 125 | *(txtptr++) = 'q'; |
116 | 126 | *((guint16 *) txtptr) = g_variant_get_uint16(value); |
117 | 127 | txtptr += sizeof(guint16); |
118 | 128 | |
129 | + debug("%s(%d)",__FUNCTION__,(int) g_variant_get_uint16(value)); | |
130 | + | |
119 | 131 | } else if(g_variant_type_is_subtype_of(type,G_VARIANT_TYPE_INT32)) { |
120 | 132 | |
121 | 133 | *(txtptr++) = 'i'; |
122 | 134 | *((gint32 *) txtptr) = g_variant_get_int32(value); |
123 | 135 | txtptr += sizeof(gint32); |
124 | 136 | |
137 | + debug("%s(%d)",__FUNCTION__,(int) g_variant_get_int32(value)); | |
138 | + | |
125 | 139 | } else if(g_variant_type_equal(type,G_VARIANT_TYPE_UINT32)) { |
126 | 140 | |
127 | 141 | *(txtptr++) = 'u'; |
128 | 142 | *((guint32 *) txtptr) = g_variant_get_uint32(value); |
129 | 143 | txtptr += sizeof(guint32); |
130 | 144 | |
145 | + debug("%s(%d)",__FUNCTION__,(int) g_variant_get_uint32(value)); | |
146 | + | |
131 | 147 | } else if(g_variant_type_equal(type,G_VARIANT_TYPE_INT64)) { |
132 | 148 | |
133 | 149 | *(txtptr++) = 'x'; |
... | ... | @@ -294,7 +310,7 @@ GVariant * ipc3270_unpack(const unsigned char *packet, int *id) { |
294 | 310 | break; |
295 | 311 | |
296 | 312 | default: |
297 | - g_message("Unexpected format for argument %d: \"%c\"",ix,descrs[ix+1]); | |
313 | + g_message("Unexpected format for argument %d: \"%c\"",(int) ix,descrs[ix+1]); | |
298 | 314 | errno = EINVAL; |
299 | 315 | return NULL; |
300 | 316 | } | ... | ... |
server/src/core/windows/pipesource.c
... | ... | @@ -290,11 +290,17 @@ static void IO_finalize(GSource *source) { |
290 | 290 | |
291 | 291 | } |
292 | 292 | |
293 | -GSourceFuncs ipc3270_source_funcs = { | |
294 | - IO_prepare, | |
295 | - IO_check, | |
296 | - IO_dispatch, | |
297 | - IO_finalize, | |
298 | - IO_closure, | |
299 | - NULL | |
300 | -}; | |
293 | +GSourceFuncs * ipc3270_get_source_funcs() { | |
294 | + | |
295 | + static GSourceFuncs source_funcs = { | |
296 | + IO_prepare, | |
297 | + IO_check, | |
298 | + IO_dispatch, | |
299 | + IO_finalize, | |
300 | + IO_closure, | |
301 | + NULL | |
302 | + }; | |
303 | + | |
304 | + return &source_funcs; | |
305 | +} | |
306 | + | ... | ... |
server/src/core/windows/start.c
... | ... | @@ -68,7 +68,7 @@ void ipc3270_export_object(GObject *object, const char *name, GError G_GNUC_UNUS |
68 | 68 | |
69 | 69 | if(hPipe != INVALID_HANDLE_VALUE) { |
70 | 70 | |
71 | - ipc->source = (IPC3270_PIPE_SOURCE *) g_source_new(&ipc3270_source_funcs,sizeof(IPC3270_PIPE_SOURCE)); | |
71 | + ipc->source = (IPC3270_PIPE_SOURCE *) g_source_new(ipc3270_get_source_funcs(),sizeof(IPC3270_PIPE_SOURCE)); | |
72 | 72 | |
73 | 73 | g_message("Got session \"%c\"",id); |
74 | 74 | ... | ... |
server/src/testprogram/testprogram.c