@@ -34,7 +34,9 @@ async function send_voice_channel_sdp(data) {
34
34
if ( ! con ) return
35
35
//We switch data address because in this case, it is from, we can change this
36
36
data . address = Hugin . address
37
- con . connection . write ( JSON . stringify ( data ) )
37
+ try {
38
+ con . connection . write ( JSON . stringify ( data ) )
39
+ } catch ( e ) { }
38
40
}
39
41
40
42
const send_voice_channel_status = async ( joined , status , update = false ) => {
@@ -131,7 +133,9 @@ const end_swarm = async (key) => {
131
133
}
132
134
133
135
active . connections . forEach ( chat => {
136
+ try {
134
137
chat . connection . write ( JSON . stringify ( { type : "disconnected" } ) )
138
+ } catch ( e ) { }
135
139
connection_closed ( chat . connection , topic )
136
140
} )
137
141
@@ -696,8 +700,9 @@ const send_joined_message = async (topic, dht_keys, connection) => {
696
700
videoMute,
697
701
screenshare
698
702
} )
699
-
700
- connection . write ( data )
703
+ try {
704
+ connection . write ( data )
705
+ } catch ( e ) { }
701
706
}
702
707
703
708
const incoming_message = async ( data , topic , connection , peer ) => {
@@ -776,7 +781,9 @@ const check_online_state = async (topic) => {
776
781
if ( i > 4 ) {
777
782
if ( i % 2 === 0 ) data . hashes = [ ]
778
783
}
784
+ try {
779
785
conn . connection . write ( JSON . stringify ( data ) )
786
+ } catch ( e ) { }
780
787
i ++
781
788
}
782
789
}
@@ -867,7 +874,11 @@ const send_peer_message = (address, topic, message) => {
867
874
return
868
875
}
869
876
console . log ( "Sending peer message" )
870
- con . connection . write ( JSON . stringify ( message ) )
877
+ try {
878
+ con . connection . write ( JSON . stringify ( message ) )
879
+ } catch ( e ) {
880
+ return
881
+ }
871
882
}
872
883
873
884
0 commit comments