Browse Source

socket: Better deal with chanfloods

tags/v0.7.0
Daniel Oaks 7 years ago
parent
commit
91fab3ba55
1 changed files with 2 additions and 3 deletions
  1. 2
    3
      irc/socket.go

+ 2
- 3
irc/socket.go View File

@@ -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

Loading…
Cancel
Save