Parcourir la source

socket: Better deal with chanfloods

tags/v0.7.0
Daniel Oaks il y a 7 ans
Parent
révision
91fab3ba55
1 fichiers modifiés avec 2 ajouts et 3 suppressions
  1. 2
    3
      irc/socket.go

+ 2
- 3
irc/socket.go Voir le fichier

@@ -160,6 +160,8 @@ func (socket *Socket) RunSocketWriter() {
160 160
 				socket.linesToSend = []string{}
161 161
 			}
162 162
 
163
+			socket.linesToSendMutex.Unlock()
164
+
163 165
 			// write data
164 166
 			if 0 < len(data) {
165 167
 				_, err := socket.conn.Write([]byte(data))
@@ -172,11 +174,8 @@ func (socket *Socket) RunSocketWriter() {
172 174
 
173 175
 			// check if we're closed
174 176
 			if socket.Closed {
175
-				socket.linesToSendMutex.Unlock()
176 177
 				break
177 178
 			}
178
-
179
-			socket.linesToSendMutex.Unlock()
180 179
 		}
181 180
 		if errOut {
182 181
 			// error out, bad stuff happened

Chargement…
Annuler
Enregistrer