Changeset 236 in code for trunk/downstream.go
- Timestamp:
- Apr 6, 2020, 5:08:43 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/downstream.go
r233 r236 67 67 network *network // can be nil 68 68 69 ourMessages map[*irc.Message]struct{}70 caps map[string]bool71 72 69 negociatingCaps bool 73 70 capVersion int 71 caps map[string]bool 74 72 75 73 saslServer sasl.Server … … 79 77 logger := &prefixLogger{srv.Logger, fmt.Sprintf("downstream %q: ", netConn.RemoteAddr())} 80 78 dc := &downstreamConn{ 81 conn: *newConn(srv, netConn, logger), 82 id: id, 83 ourMessages: make(map[*irc.Message]struct{}), 84 caps: make(map[string]bool), 79 conn: *newConn(srv, netConn, logger), 80 id: id, 81 caps: make(map[string]bool), 85 82 } 86 83 dc.hostname = netConn.RemoteAddr().String() … … 227 224 228 225 func (dc *downstreamConn) sendFromUpstream(msg *irc.Message, uc *upstreamConn) { 229 _, ours := dc.ourMessages[msg]230 delete(dc.ourMessages, msg)231 if ours && !dc.caps["echo-message"] {232 // The message comes from our connection, don't echo it233 // back234 return235 }236 237 226 msg = msg.Copy() 238 227 switch msg.Command { … … 1197 1186 Params: []string{upstreamName, text}, 1198 1187 } 1199 dc.ourMessages[echoMsg] = struct{}{}1200 1188 1201 1189 uc.appendLog(upstreamName, echoMsg) 1202 1190 1203 uc.produce(echoMsg) 1191 uc.network.ring.Produce(echoMsg) 1192 1193 uc.forEachDownstream(func(c *downstreamConn) { 1194 if c != dc || c.caps["echo-message"] { 1195 c.sendFromUpstream(echoMsg, uc) 1196 } 1197 }) 1204 1198 } 1205 1199 case "NOTICE":
Note:
See TracChangeset
for help on using the changeset viewer.