MCPcopy Create free account
hub / github.com/apache/arrow / service_incoming

Function service_incoming

c_glib/example/receive-network.c:116–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116static gboolean
117service_incoming(GSocketService *service,
118 GSocketConnection *connection,
119 GObject *source_object,
120 gpointer user_data)
121{
122 GArrowGIOInputStream *input =
123 garrow_gio_input_stream_new(g_io_stream_get_input_stream(G_IO_STREAM(connection)));
124 GError *error = NULL;
125 GArrowRecordBatchStreamReader *reader =
126 garrow_record_batch_stream_reader_new(GARROW_INPUT_STREAM(input), &error);
127 if (!reader) {
128 g_print("failed to create reader: %s\n", error->message);
129 g_error_free(error);
130 g_object_unref(input);
131 return FALSE;
132 }
133
134 while (TRUE) {
135 GArrowRecordBatch *record_batch =
136 garrow_record_batch_reader_read_next(GARROW_RECORD_BATCH_READER(reader), &error);
137 if (error) {
138 g_print("failed to read the next record batch: %s\n", error->message);
139 g_error_free(error);
140 g_object_unref(reader);
141 g_object_unref(input);
142 return EXIT_FAILURE;
143 }
144
145 if (!record_batch) {
146 break;
147 }
148
149 print_record_batch(record_batch);
150 g_object_unref(record_batch);
151 }
152
153 g_object_unref(reader);
154 g_object_unref(input);
155
156 return FALSE;
157}
158
159#ifdef G_OS_UNIX
160typedef struct

Callers

nothing calls this directly

Tested by

no test coverage detected