v86 0.5.194 → 0.5.199

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4646,7 +4646,7 @@ $FS$$module$lib$filesystem$$.prototype.HandleEvent = function($id$jscomp$9$$) {
4646
4646
  $FS$$module$lib$filesystem$$.prototype.load_from_json = function($fs$jscomp$1_i$jscomp$61$$) {
4647
4647
  $dbg_assert$$module$src$log$$($fs$jscomp$1_i$jscomp$61$$, "Invalid fs passed to load_from_json");
4648
4648
  if (3 !== $fs$jscomp$1_i$jscomp$61$$.version) {
4649
- throw "The filesystem JSON format has changed. Please update your fs2json (https://github.com/copy/fs2json) and recreate the filesystem JSON.";
4649
+ throw "The filesystem JSON format has changed. Please recreate the filesystem JSON.";
4650
4650
  }
4651
4651
  var $fsroot$$ = $fs$jscomp$1_i$jscomp$61$$.fsroot;
4652
4652
  this.used_size = $fs$jscomp$1_i$jscomp$61$$.size;
@@ -5672,20 +5672,28 @@ $V86$$module$src$browser$starter$$.prototype.continue_init = async function($emu
5672
5672
  $add_file_boot_order_fs_url_relay_url_screen_options$$("multiboot", $options$jscomp$41$$.multiboot);
5673
5673
  $add_file_boot_order_fs_url_relay_url_screen_options$$("bzimage", $options$jscomp$41$$.bzimage);
5674
5674
  $add_file_boot_order_fs_url_relay_url_screen_options$$("initrd", $options$jscomp$41$$.initrd);
5675
- if ($options$jscomp$41$$.filesystem) {
5676
- $add_file_boot_order_fs_url_relay_url_screen_options$$ = $options$jscomp$41$$.filesystem.basefs;
5677
- var $base_url$$ = $options$jscomp$41$$.filesystem.baseurl;
5678
- let $file_storage$jscomp$1$$ = new $MemoryFileStorage$$module$src$browser$filestorage$$;
5679
- $base_url$$ && ($file_storage$jscomp$1$$ = new $ServerFileStorageWrapper$$module$src$browser$filestorage$$($file_storage$jscomp$1$$, $base_url$$));
5680
- $settings$$.fs9p = this.fs9p = new $FS$$module$lib$filesystem$$($file_storage$jscomp$1$$);
5681
- if ($add_file_boot_order_fs_url_relay_url_screen_options$$) {
5682
- $dbg_assert$$module$src$log$$($base_url$$, "Filesystem: baseurl must be specified");
5683
- if ("object" === typeof $add_file_boot_order_fs_url_relay_url_screen_options$$) {
5684
- var $size$jscomp$35$$ = $add_file_boot_order_fs_url_relay_url_screen_options$$.size;
5685
- $add_file_boot_order_fs_url_relay_url_screen_options$$ = $add_file_boot_order_fs_url_relay_url_screen_options$$.url;
5675
+ if ($options$jscomp$41$$.filesystem && $options$jscomp$41$$.filesystem.handle9p) {
5676
+ $settings$$.handle9p = $options$jscomp$41$$.filesystem.handle9p;
5677
+ } else {
5678
+ if ($options$jscomp$41$$.filesystem && $options$jscomp$41$$.filesystem.proxy_url) {
5679
+ $settings$$.proxy9p = $options$jscomp$41$$.filesystem.proxy_url;
5680
+ } else {
5681
+ if ($options$jscomp$41$$.filesystem) {
5682
+ $add_file_boot_order_fs_url_relay_url_screen_options$$ = $options$jscomp$41$$.filesystem.basefs;
5683
+ var $base_url$$ = $options$jscomp$41$$.filesystem.baseurl;
5684
+ let $file_storage$jscomp$1$$ = new $MemoryFileStorage$$module$src$browser$filestorage$$;
5685
+ $base_url$$ && ($file_storage$jscomp$1$$ = new $ServerFileStorageWrapper$$module$src$browser$filestorage$$($file_storage$jscomp$1$$, $base_url$$));
5686
+ $settings$$.fs9p = this.fs9p = new $FS$$module$lib$filesystem$$($file_storage$jscomp$1$$);
5687
+ if ($add_file_boot_order_fs_url_relay_url_screen_options$$) {
5688
+ $dbg_assert$$module$src$log$$($base_url$$, "Filesystem: baseurl must be specified");
5689
+ if ("object" === typeof $add_file_boot_order_fs_url_relay_url_screen_options$$) {
5690
+ var $size$jscomp$35$$ = $add_file_boot_order_fs_url_relay_url_screen_options$$.size;
5691
+ $add_file_boot_order_fs_url_relay_url_screen_options$$ = $add_file_boot_order_fs_url_relay_url_screen_options$$.url;
5692
+ }
5693
+ $dbg_assert$$module$src$log$$("string" === typeof $add_file_boot_order_fs_url_relay_url_screen_options$$);
5694
+ $files_to_load$$.push({name:"fs9p_json", url:$add_file_boot_order_fs_url_relay_url_screen_options$$, size:$size$jscomp$35$$, as_json:!0, });
5695
+ }
5686
5696
  }
5687
- $dbg_assert$$module$src$log$$("string" === typeof $add_file_boot_order_fs_url_relay_url_screen_options$$);
5688
- $files_to_load$$.push({name:"fs9p_json", url:$add_file_boot_order_fs_url_relay_url_screen_options$$, size:$size$jscomp$35$$, as_json:!0, });
5689
5697
  }
5690
5698
  }
5691
5699
  var $starter$$ = this, $total$jscomp$1$$ = $files_to_load$$.length, $cont$$ = function($index$jscomp$83$$) {
@@ -11571,8 +11579,8 @@ $CPU$$module$src$cpu$$.prototype.init = function($option_rom$jscomp$1_settings$j
11571
11579
  new $UART$$module$src$uart$$(this, 1E3, $device_bus$$)), $option_rom$jscomp$1_settings$jscomp$2$$.uart3 && (this.devices.uart3 = new $UART$$module$src$uart$$(this, 744, $device_bus$$)), this.devices.fdc = new $FloppyController$$module$src$floppy$$(this, $option_rom$jscomp$1_settings$jscomp$2$$.fda, $option_rom$jscomp$1_settings$jscomp$2$$.fdb), $ide_config$jscomp$2_io$jscomp$5$$ = [[void 0, void 0], [void 0, void 0]], $option_rom$jscomp$1_settings$jscomp$2$$.hda && ($ide_config$jscomp$2_io$jscomp$5$$[0][0] =
11572
11580
  {buffer:$option_rom$jscomp$1_settings$jscomp$2$$.hda}, $ide_config$jscomp$2_io$jscomp$5$$[0][1] = {buffer:$option_rom$jscomp$1_settings$jscomp$2$$.hdb}), $ide_config$jscomp$2_io$jscomp$5$$[1][0] = {is_cdrom:!0, buffer:$option_rom$jscomp$1_settings$jscomp$2$$.cdrom}, this.devices.ide = new $IDEController$$module$src$ide$$(this, $device_bus$$, $ide_config$jscomp$2_io$jscomp$5$$), this.devices.cdrom = this.devices.ide.secondary.master, this.devices.pit = new $PIT$$module$src$pit$$(this, $device_bus$$),
11573
11581
  "ne2k" === $option_rom$jscomp$1_settings$jscomp$2$$.net_device.type ? this.devices.net = new $Ne2k$$module$src$ne2k$$(this, $device_bus$$, $option_rom$jscomp$1_settings$jscomp$2$$.preserve_mac_from_state_image, $option_rom$jscomp$1_settings$jscomp$2$$.mac_address_translation) : "virtio" === $option_rom$jscomp$1_settings$jscomp$2$$.net_device.type && (this.devices.virtio_net = new $VirtioNet$$module$src$virtio_net$$(this, $device_bus$$, $option_rom$jscomp$1_settings$jscomp$2$$.preserve_mac_from_state_image)),
11574
- $option_rom$jscomp$1_settings$jscomp$2$$.fs9p && (this.devices.virtio_9p = new $Virtio9p$$module$lib$9p$$($option_rom$jscomp$1_settings$jscomp$2$$.fs9p, this, $device_bus$$)), $option_rom$jscomp$1_settings$jscomp$2$$.virtio_console && (this.devices.virtio_console = new $VirtioConsole$$module$src$virtio_console$$(this, $device_bus$$)), $option_rom$jscomp$1_settings$jscomp$2$$.virtio_balloon && (this.devices.virtio_balloon = new $VirtioBalloon$$module$src$virtio_balloon$$(this, $device_bus$$)), this.devices.sb16 =
11575
- new $SB16$$module$src$sb16$$(this, $device_bus$$));
11582
+ $option_rom$jscomp$1_settings$jscomp$2$$.fs9p ? this.devices.virtio_9p = new $Virtio9p$$module$lib$9p$$($option_rom$jscomp$1_settings$jscomp$2$$.fs9p, this, $device_bus$$) : $option_rom$jscomp$1_settings$jscomp$2$$.handle9p ? this.devices.virtio_9p = new $Virtio9pHandler$$module$lib$9p$$($option_rom$jscomp$1_settings$jscomp$2$$.handle9p, this) : $option_rom$jscomp$1_settings$jscomp$2$$.proxy9p && (this.devices.virtio_9p = new $Virtio9pProxy$$module$lib$9p$$($option_rom$jscomp$1_settings$jscomp$2$$.proxy9p,
11583
+ this)), $option_rom$jscomp$1_settings$jscomp$2$$.virtio_console && (this.devices.virtio_console = new $VirtioConsole$$module$src$virtio_console$$(this, $device_bus$$)), $option_rom$jscomp$1_settings$jscomp$2$$.virtio_balloon && (this.devices.virtio_balloon = new $VirtioBalloon$$module$src$virtio_balloon$$(this, $device_bus$$)), this.devices.sb16 = new $SB16$$module$src$sb16$$(this, $device_bus$$));
11576
11584
  $option_rom$jscomp$1_settings$jscomp$2$$.multiboot && ($dbg_log$$module$src$log$$("loading multiboot", 2), $option_rom$jscomp$1_settings$jscomp$2$$ = this.load_multiboot_option_rom($option_rom$jscomp$1_settings$jscomp$2$$.multiboot, $option_rom$jscomp$1_settings$jscomp$2$$.initrd, $option_rom$jscomp$1_settings$jscomp$2$$.cmdline)) && (this.bios.main ? ($dbg_log$$module$src$log$$("adding option rom for multiboot", 2), this.option_roms.push($option_rom$jscomp$1_settings$jscomp$2$$)) : ($dbg_log$$module$src$log$$("loaded multiboot without bios",
11577
11585
  2), this.reg32[0] = this.io.port_read32(244)));
11578
11586
  this.debug_init();
@@ -12506,30 +12514,35 @@ $VirtQueueBufferChain$$module$src$virtio$$.prototype.set_next_blob = function($s
12506
12514
  return $src_offset$$;
12507
12515
  };
12508
12516
  const $P9_LOCK_TYPES$$module$lib$9p$$ = ["shared", "exclusive", "unlock"];
12509
- function $Virtio9p$$module$lib$9p$$($filesystem$jscomp$2$$, $cpu$jscomp$31$$, $bus$jscomp$27$$) {
12517
+ function $init_virtio$$module$lib$9p$$($cpu$jscomp$31$$, $configspace_taglen$$, $configspace_tagname$$, $receive$$) {
12518
+ const $virtio$jscomp$1$$ = new $VirtIO$$module$src$virtio$$($cpu$jscomp$31$$, {name:"virtio-9p", pci_id:48, device_id:4169, subsystem_device_id:9, common:{initial_port:43008, queues:[{size_supported:32, notify_offset:0, }, ], features:[0, 32, 29, 28, ], on_driver_ok:() => {
12519
+ }, }, notification:{initial_port:43264, single_handler:!1, handlers:[$queue_id$jscomp$15_virtqueue$jscomp$1$$ => {
12520
+ if (0 !== $queue_id$jscomp$15_virtqueue$jscomp$1$$) {
12521
+ $dbg_assert$$module$src$log$$(!1, "Virtio9P Notified for non-existent queue: " + $queue_id$jscomp$15_virtqueue$jscomp$1$$ + " (expected queue_id of 0)");
12522
+ } else {
12523
+ for ($queue_id$jscomp$15_virtqueue$jscomp$1$$ = $virtio$jscomp$1$$.queues[0]; $queue_id$jscomp$15_virtqueue$jscomp$1$$.has_request();) {
12524
+ const $bufchain$jscomp$19$$ = $queue_id$jscomp$15_virtqueue$jscomp$1$$.pop_request();
12525
+ $receive$$($bufchain$jscomp$19$$);
12526
+ }
12527
+ $queue_id$jscomp$15_virtqueue$jscomp$1$$.notify_me_after(0);
12528
+ }
12529
+ }, ], }, isr_status:{initial_port:42752, }, device_specific:{initial_port:42496, struct:[{bytes:2, name:"mount tag length", read:() => $configspace_taglen$$, write:() => {
12530
+ }, }, ].concat(Array.from(Array(254).keys()).map($index$jscomp$93$$ => ({bytes:1, name:"mount tag name " + $index$jscomp$93$$, read:() => $configspace_tagname$$[$index$jscomp$93$$] || 0, write:() => {
12531
+ }, }))), }, });
12532
+ return $virtio$jscomp$1$$;
12533
+ }
12534
+ function $Virtio9p$$module$lib$9p$$($filesystem$jscomp$2$$, $cpu$jscomp$32$$, $bus$jscomp$27$$) {
12510
12535
  this.fs = $filesystem$jscomp$2$$;
12511
12536
  this.bus = $bus$jscomp$27$$;
12512
12537
  this.configspace_tagname = [104, 111, 115, 116, 57, 112];
12513
12538
  this.configspace_taglen = this.configspace_tagname.length;
12539
+ this.virtio = $init_virtio$$module$lib$9p$$($cpu$jscomp$32$$, this.configspace_taglen, this.configspace_tagname, this.ReceiveRequest.bind(this));
12540
+ this.virtqueue = this.virtio.queues[0];
12514
12541
  this.VERSION = "9P2000.L";
12515
12542
  this.msize = this.BLOCKSIZE = 8192;
12516
12543
  this.replybuffer = new Uint8Array(2 * this.msize);
12517
12544
  this.replybuffersize = 0;
12518
12545
  this.fids = [];
12519
- this.virtio = new $VirtIO$$module$src$virtio$$($cpu$jscomp$31$$, {name:"virtio-9p", pci_id:48, device_id:4169, subsystem_device_id:9, common:{initial_port:43008, queues:[{size_supported:32, notify_offset:0, }, ], features:[0, 32, 29, 28, ], on_driver_ok:() => {
12520
- }, }, notification:{initial_port:43264, single_handler:!1, handlers:[$bufchain$jscomp$19_queue_id$jscomp$15$$ => {
12521
- if (0 !== $bufchain$jscomp$19_queue_id$jscomp$15$$) {
12522
- $dbg_assert$$module$src$log$$(!1, "Virtio9P Notified for non-existent queue: " + $bufchain$jscomp$19_queue_id$jscomp$15$$ + " (expected queue_id of 0)");
12523
- } else {
12524
- for (; this.virtqueue.has_request();) {
12525
- $bufchain$jscomp$19_queue_id$jscomp$15$$ = this.virtqueue.pop_request(), this.ReceiveRequest($bufchain$jscomp$19_queue_id$jscomp$15$$);
12526
- }
12527
- this.virtqueue.notify_me_after(0);
12528
- }
12529
- }, ], }, isr_status:{initial_port:42752, }, device_specific:{initial_port:42496, struct:[{bytes:2, name:"mount tag length", read:() => this.configspace_taglen, write:() => {
12530
- }, }, ].concat(Array.from(Array(254).keys()).map($index$jscomp$93$$ => ({bytes:1, name:"mount tag name " + $index$jscomp$93$$, read:() => this.configspace_tagname[$index$jscomp$93$$] || 0, write:() => {
12531
- }, }))), }, });
12532
- this.virtqueue = this.virtio.queues[0];
12533
12546
  }
12534
12547
  $Virtio9p$$module$lib$9p$$.prototype.get_state = function() {
12535
12548
  var $state$jscomp$68$$ = [];
@@ -13011,4 +13024,133 @@ $Virtio9p$$module$lib$9p$$.prototype.ReceiveRequest = async function($bufchain$j
13011
13024
  $dbg_log$$module$src$log$$("Error in Virtio9p: Unknown id " + $id$jscomp$29$$ + " received", 4194304), $dbg_assert$$module$src$log$$(!1);
13012
13025
  }
13013
13026
  };
13027
+ function $Virtio9pHandler$$module$lib$9p$$($handle_fn$$, $cpu$jscomp$33$$) {
13028
+ this.handle_fn = $handle_fn$$;
13029
+ this.tag_bufchain = new Map;
13030
+ this.configspace_tagname = [104, 111, 115, 116, 57, 112];
13031
+ this.configspace_taglen = this.configspace_tagname.length;
13032
+ this.virtio = $init_virtio$$module$lib$9p$$($cpu$jscomp$33$$, this.configspace_taglen, this.configspace_tagname, async $bufchain$jscomp$22$$ => {
13033
+ const $reqbuf$$ = new Uint8Array($bufchain$jscomp$22$$.length_readable);
13034
+ $bufchain$jscomp$22$$.get_next_blob($reqbuf$$);
13035
+ var $reqtag$$ = $Unmarshall$$module$lib$marshall$$(["w", "b", "h"], $reqbuf$$, {offset:0})[2];
13036
+ this.tag_bufchain.set($reqtag$$, $bufchain$jscomp$22$$);
13037
+ this.handle_fn($reqbuf$$, $replybuf$$ => {
13038
+ var $replytag$$ = $Unmarshall$$module$lib$marshall$$(["w", "b", "h"], $replybuf$$, {offset:0})[2];
13039
+ const $bufchain$jscomp$23$$ = this.tag_bufchain.get($replytag$$);
13040
+ $bufchain$jscomp$23$$ ? ($bufchain$jscomp$23$$.set_next_blob($replybuf$$), this.virtqueue.push_reply($bufchain$jscomp$23$$), this.virtqueue.flush_replies(), this.tag_bufchain.delete($replytag$$)) : console.error("No bufchain found for tag: " + $replytag$$);
13041
+ });
13042
+ });
13043
+ this.virtqueue = this.virtio.queues[0];
13044
+ }
13045
+ $Virtio9pHandler$$module$lib$9p$$.prototype.get_state = function() {
13046
+ var $state$jscomp$71$$ = [];
13047
+ $state$jscomp$71$$[0] = this.configspace_tagname;
13048
+ $state$jscomp$71$$[1] = this.configspace_taglen;
13049
+ $state$jscomp$71$$[2] = this.virtio;
13050
+ $state$jscomp$71$$[3] = this.tag_bufchain;
13051
+ return $state$jscomp$71$$;
13052
+ };
13053
+ $Virtio9pHandler$$module$lib$9p$$.prototype.set_state = function($state$jscomp$72$$) {
13054
+ this.configspace_tagname = $state$jscomp$72$$[0];
13055
+ this.configspace_taglen = $state$jscomp$72$$[1];
13056
+ this.virtio.set_state($state$jscomp$72$$[2]);
13057
+ this.virtqueue = this.virtio.queues[0];
13058
+ this.tag_bufchain = $state$jscomp$72$$[3];
13059
+ };
13060
+ $Virtio9pHandler$$module$lib$9p$$.prototype.reset = function() {
13061
+ this.virtio.reset();
13062
+ };
13063
+ function $Virtio9pProxy$$module$lib$9p$$($url$jscomp$28$$, $cpu$jscomp$34$$) {
13064
+ this.socket = void 0;
13065
+ this.cpu = $cpu$jscomp$34$$;
13066
+ this.send_queue = [];
13067
+ this.url = $url$jscomp$28$$;
13068
+ this.reconnect_interval = 10000;
13069
+ this.last_connect_attempt = Date.now() - this.reconnect_interval;
13070
+ this.send_queue_limit = 64;
13071
+ this.destroyed = !1;
13072
+ this.tag_bufchain = new Map;
13073
+ this.configspace_tagname = [104, 111, 115, 116, 57, 112];
13074
+ this.configspace_taglen = this.configspace_tagname.length;
13075
+ this.virtio = $init_virtio$$module$lib$9p$$($cpu$jscomp$34$$, this.configspace_taglen, this.configspace_tagname, async $bufchain$jscomp$24$$ => {
13076
+ const $reqbuf$jscomp$1$$ = new Uint8Array($bufchain$jscomp$24$$.length_readable);
13077
+ $bufchain$jscomp$24$$.get_next_blob($reqbuf$jscomp$1$$);
13078
+ const $reqtag$jscomp$1$$ = $Unmarshall$$module$lib$marshall$$(["w", "b", "h"], $reqbuf$jscomp$1$$, {offset:0})[2];
13079
+ this.tag_bufchain.set($reqtag$jscomp$1$$, $bufchain$jscomp$24$$);
13080
+ this.send($reqbuf$jscomp$1$$);
13081
+ });
13082
+ this.virtqueue = this.virtio.queues[0];
13083
+ }
13084
+ $Virtio9pProxy$$module$lib$9p$$.prototype.get_state = function() {
13085
+ var $state$jscomp$73$$ = [];
13086
+ $state$jscomp$73$$[0] = this.configspace_tagname;
13087
+ $state$jscomp$73$$[1] = this.configspace_taglen;
13088
+ $state$jscomp$73$$[2] = this.virtio;
13089
+ $state$jscomp$73$$[3] = this.tag_bufchain;
13090
+ return $state$jscomp$73$$;
13091
+ };
13092
+ $Virtio9pProxy$$module$lib$9p$$.prototype.set_state = function($state$jscomp$74$$) {
13093
+ this.configspace_tagname = $state$jscomp$74$$[0];
13094
+ this.configspace_taglen = $state$jscomp$74$$[1];
13095
+ this.virtio.set_state($state$jscomp$74$$[2]);
13096
+ this.virtqueue = this.virtio.queues[0];
13097
+ this.tag_bufchain = $state$jscomp$74$$[3];
13098
+ };
13099
+ $Virtio9pProxy$$module$lib$9p$$.prototype.reset = function() {
13100
+ this.virtio.reset();
13101
+ };
13102
+ $Virtio9pProxy$$module$lib$9p$$.prototype.handle_message = function($e$jscomp$52_replybuf$jscomp$1$$) {
13103
+ $e$jscomp$52_replybuf$jscomp$1$$ = new Uint8Array($e$jscomp$52_replybuf$jscomp$1$$.data);
13104
+ const $replytag$jscomp$1$$ = $Unmarshall$$module$lib$marshall$$(["w", "b", "h"], $e$jscomp$52_replybuf$jscomp$1$$, {offset:0})[2], $bufchain$jscomp$25$$ = this.tag_bufchain.get($replytag$jscomp$1$$);
13105
+ $bufchain$jscomp$25$$ ? ($bufchain$jscomp$25$$.set_next_blob($e$jscomp$52_replybuf$jscomp$1$$), this.virtqueue.push_reply($bufchain$jscomp$25$$), this.virtqueue.flush_replies(), this.tag_bufchain.delete($replytag$jscomp$1$$)) : console.error("Virtio9pProxy: No bufchain found for tag: " + $replytag$jscomp$1$$);
13106
+ };
13107
+ $Virtio9pProxy$$module$lib$9p$$.prototype.handle_close = function() {
13108
+ this.destroyed || (this.connect(), setTimeout(this.connect.bind(this), this.reconnect_interval));
13109
+ };
13110
+ $Virtio9pProxy$$module$lib$9p$$.prototype.handle_open = function() {
13111
+ for (var $i$jscomp$130$$ = 0; $i$jscomp$130$$ < this.send_queue.length; $i$jscomp$130$$++) {
13112
+ this.send(this.send_queue[$i$jscomp$130$$]);
13113
+ }
13114
+ this.send_queue = [];
13115
+ };
13116
+ $Virtio9pProxy$$module$lib$9p$$.prototype.handle_error = function() {
13117
+ };
13118
+ $Virtio9pProxy$$module$lib$9p$$.prototype.destroy = function() {
13119
+ this.destroyed = !0;
13120
+ this.socket && this.socket.close();
13121
+ };
13122
+ $Virtio9pProxy$$module$lib$9p$$.prototype.connect = function() {
13123
+ if ("undefined" !== typeof WebSocket) {
13124
+ if (this.socket) {
13125
+ var $now$jscomp$15_state$jscomp$75$$ = this.socket.readyState;
13126
+ if (0 === $now$jscomp$15_state$jscomp$75$$ || 1 === $now$jscomp$15_state$jscomp$75$$) {
13127
+ return;
13128
+ }
13129
+ }
13130
+ $now$jscomp$15_state$jscomp$75$$ = Date.now();
13131
+ if (!(this.last_connect_attempt + this.reconnect_interval > $now$jscomp$15_state$jscomp$75$$)) {
13132
+ this.last_connect_attempt = Date.now();
13133
+ try {
13134
+ this.socket = new WebSocket(this.url);
13135
+ } catch ($e$jscomp$56$$) {
13136
+ console.error($e$jscomp$56$$);
13137
+ return;
13138
+ }
13139
+ this.socket.binaryType = "arraybuffer";
13140
+ this.socket.onopen = this.handle_open.bind(this);
13141
+ this.socket.onmessage = this.handle_message.bind(this);
13142
+ this.socket.onclose = this.handle_close.bind(this);
13143
+ this.socket.onerror = this.handle_error.bind(this);
13144
+ }
13145
+ }
13146
+ };
13147
+ $Virtio9pProxy$$module$lib$9p$$.prototype.send = function($data$jscomp$247$$) {
13148
+ this.socket && 1 === this.socket.readyState ? this.socket.send($data$jscomp$247$$) : (this.send_queue.push($data$jscomp$247$$), this.send_queue.length > 2 * this.send_queue_limit && (this.send_queue = this.send_queue.slice(-this.send_queue_limit)), this.connect());
13149
+ };
13150
+ $Virtio9pProxy$$module$lib$9p$$.prototype.change_proxy = function($url$jscomp$29$$) {
13151
+ this.url = $url$jscomp$29$$;
13152
+ this.socket && (this.socket.onclose = function() {
13153
+ }, this.socket.onerror = function() {
13154
+ }, this.socket.close(), this.socket = void 0);
13155
+ };
13014
13156
  }).call(this);