()
| 980 | } |
| 981 | |
| 982 | func (sc *serverConn) writeLoop() { |
| 983 | if sc.pingInterval > 0 { |
| 984 | sc.pingTimer = time.AfterFunc(sc.pingInterval, sc.sendPingAndSchedule) |
| 985 | } |
| 986 | |
| 987 | buffered := 0 |
| 988 | |
| 989 | for fr := range sc.writer { |
| 990 | _, err := fr.WriteTo(sc.bw) |
| 991 | if err == nil && (len(sc.writer) == 0 || buffered > 10) { |
| 992 | err = sc.bw.Flush() |
| 993 | buffered = 0 |
| 994 | } else if err == nil { |
| 995 | buffered++ |
| 996 | } |
| 997 | |
| 998 | ReleaseFrameHeader(fr) |
| 999 | |
| 1000 | if err != nil { |
| 1001 | sc.logger.Printf("ERROR: writeLoop: %s\n", err) |
| 1002 | // TODO: sc.writer.err <- err |
| 1003 | return |
| 1004 | } |
| 1005 | } |
| 1006 | } |
| 1007 | |
| 1008 | func (sc *serverConn) handleSettings(st *Settings) { |
| 1009 | st.CopyTo(&sc.clientS) |
no test coverage detected