Browse Source

chore(release): 1.2.1

Matthias Ladkau 5 years ago
parent
commit
d90a218d48
3 changed files with 23 additions and 7 deletions
  1. 4 0
      CHANGELOG.md
  2. 18 6
      requesthandler.go
  3. 1 1
      server.go

+ 4 - 0
CHANGELOG.md

@@ -2,6 +2,10 @@
 
 All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
 
+### [1.2.1](https://devt.de///compare/v1.2.0...v1.2.1) (2019-09-21)
+
+
+
 ## [1.2.0](https://devt.de///compare/v1.1.0...v1.2.0) (2019-09-13)
 
 

+ 18 - 6
requesthandler.go

@@ -286,10 +286,10 @@ func (drh *DefaultRequestHandler) defaultServeRequest(c net.Conn, path string, m
 }
 
 /*
-writeFrame writes a frame to a client.
+prepareFrame prepares a frame before it can be written to a client.
 */
-func (drh *DefaultRequestHandler) writeFrame(c net.Conn, pl Playlist, frameOffset int,
-	writtenBytes uint64, metaDataSupport bool) (int, uint64, error) {
+func (drh *DefaultRequestHandler) prepareFrame(c net.Conn, pl Playlist, frameOffset int,
+	writtenBytes uint64, metaDataSupport bool) ([]byte, int, error) {
 
 	frame, err := pl.Frame()
 
@@ -318,8 +318,6 @@ func (drh *DefaultRequestHandler) writeFrame(c net.Conn, pl Playlist, frameOffse
 			Print(fmt.Sprintf("Empty frame for: %v - %v (Error: %v)", pl.Title(), pl.Artist(), err))
 		}
 
-		return frameOffset, writtenBytes, err
-
 	} else if err != nil {
 
 		if err != ErrPlaylistEnd {
@@ -329,6 +327,20 @@ func (drh *DefaultRequestHandler) writeFrame(c net.Conn, pl Playlist, frameOffse
 		err = nil
 	}
 
+	return frame, frameOffset, err
+}
+
+/*
+writeFrame writes a frame to a client.
+*/
+func (drh *DefaultRequestHandler) writeFrame(c net.Conn, pl Playlist, frameOffset int,
+	writtenBytes uint64, metaDataSupport bool) (int, uint64, error) {
+
+	frame, frameOffset, err := drh.prepareFrame(c, pl, frameOffset, writtenBytes, metaDataSupport)
+	if frame == nil {
+		return frameOffset, writtenBytes, err
+	}
+
 	// Check if meta data should be send
 
 	if metaDataSupport && writtenBytes+uint64(len(frame)) >= MetaDataInterval {
@@ -448,7 +460,7 @@ func (drh *DefaultRequestHandler) writeUnauthorized(c net.Conn) error {
 }
 
 /*
-debug will print additional debug output if `DebugOutput` is enabled.
+printDebug will print additional debug output if `DebugOutput` is enabled.
 */
 func printDebug(v ...interface{}) {
 	if DebugOutput {

+ 1 - 1
server.go

@@ -22,7 +22,7 @@ import (
 /*
 ProductVersion is the current version of DudelDu
 */
-const ProductVersion = "1.2.0"
+const ProductVersion = "1.2.1"
 
 /*
 ConnectionHandler is a function to handle new connections