I develop an app in Vala (0.30) and libsoup (2.50.0) in which I start my websocket server. I currently develop on the most recent Mac OS X but it is intended to be a multiplatform app.
I pass callback function as a handler and setup signal callbacks for "closed", "message" etc.. Everything works fine except the last parameter (ClientContext). When I try to determine any information about the client (by calling get_host(), get_remote_address()) etc. I always get crash and the following error
(radiokit-electron-backbone-daemon:61087): libsoup-CRITICAL **: soup_socket_get_remote_address: assertion 'SOUP_IS_SOCKET (sock)' failed
Similar calls for non-websocket soup servers work fine.
Stacktrace is below. Am I doing something wrong or is it a bug?
* thread #1: tid = 0x0000, 0x000000010f64cc3d libglib-2.0.0.dylib`g_logv + 941, stop reason = signal SIGSTOP
* frame #0: 0x000000010f64cc3d libglib-2.0.0.dylib`g_logv + 941
frame #1: 0x000000010f64d626 libglib-2.0.0.dylib`g_log + 134
frame #2: 0x000000010f2c93af libsoup-2.4.1.dylib`soup_socket_get_remote_address + 255
frame #3: 0x000000010f2bce72 libsoup-2.4.1.dylib`soup_client_context_get_host + 18
frame #4: 0x000000010f0de70c libmyapp-common.0.dylib`_my_app_common_rpc_web_socket_server_flux_handler_soup_server_websocket_callback [inlined] my_app_common_rpc_web_socket_server_flux_handler + 53 at websocket_server.c:393
frame #5: 0x000000010f0de6d7 libmyapp-common.0.dylib`_my_app_common_rpc_web_socket_server_flux_handler_soup_server_websocket_callback(server=<unavailable>, connection=0x00007fcb690193f0, path=<unavailable>, client=<unavailable>, self=0x00007fcb6a001300) + 23 at websocket_server.c:140
frame #6: 0x000000010f2be539 libsoup-2.4.1.dylib`complete_websocket_upgrade + 345
frame #7: 0x000000010f59ae7a libgobject-2.0.0.dylib`_g_closure_invoke_va + 314
frame #8: 0x000000010f5b23f2 libgobject-2.0.0.dylib`g_signal_emit_valist + 1522
frame #9: 0x000000010f5b2db6 libgobject-2.0.0.dylib`g_signal_emit + 134
frame #10: 0x000000010f2b33d2 libsoup-2.4.1.dylib`io_run_until + 1058
frame #11: 0x000000010f2b3e02 libsoup-2.4.1.dylib`io_run + 146
frame #12: 0x000000010f2b4fb6 libsoup-2.4.1.dylib`soup_message_read_request + 134
frame #13: 0x000000010f59e3d2 libgobject-2.0.0.dylib`g_cclosure_marshal_VOID__OBJECTv + 162
frame #14: 0x000000010f59ae7a libgobject-2.0.0.dylib`_g_closure_invoke_va + 314
frame #15: 0x000000010f5b23f2 libgobject-2.0.0.dylib`g_signal_emit_valist + 1522
frame #16: 0x000000010f5b2db6 libgobject-2.0.0.dylib`g_signal_emit + 134
frame #17: 0x000000010f2c9dbf libsoup-2.4.1.dylib`listen_watch + 271
frame #18: 0x000000010f644556 libglib-2.0.0.dylib`g_main_context_dispatch + 326
frame #19: 0x000000010f64487b libglib-2.0.0.dylib`g_main_context_iterate + 411
frame #20: 0x000000010f644b8f libglib-2.0.0.dylib`g_main_loop_run + 207
frame #21: 0x000000010f0e976e libmyapp-common.0.dylib`my_app_common_app_daemon_start(self=0x00007fcb6a000160, error=0x00007fcb685222e0) + 2318 at daemon.c:470
frame #22: 0x000000010f0bf959 myapp-daemon`my_app_daemon_construct(object_type=<unavailable>) + 89 at daemon.c:170
frame #23: 0x000000010f0bf7b6 myapp-daemon`my_app_daemon_main [inlined] my_app_daemon_new + 86 at daemon.c:183
frame #24: 0x000000010f0bf764 myapp-daemon`my_app_daemon_main(argv=<unavailable>, argv_length1=<unavailable>) + 4 at daemon.c:124
frame #25: 0x000000010f0bf8f9 myapp-daemon`main(argc=<unavailable>, argv=<unavailable>) + 9 at daemon.c:154
frame #26: 0x00007fff8ef6c5ad libdyld.dylib`start + 1
frame #27: 0x00007fff8ef6c5ad libdyld.dylib`start + 1