File tree Expand file tree Collapse file tree
whip/src/main/java/com/pedro/whip Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -388,7 +388,9 @@ class WhipClient(private val connectChecker: ConnectChecker) {
388388 dtlsConnection?.close()
389389 dtlsConnection = null
390390 val error = runCatching {
391- // TODO write delete command
391+ withTimeoutOrNull(100 .milliseconds) {
392+ commandsManager.writeDelete()
393+ }
392394 Log .i(TAG , " write delete success" )
393395 }.exceptionOrNull()
394396 if (error != null ) {
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ object Requests {
3939 val responseHeaders = mutableMapOf<String , String >()
4040 socket.headerFields.forEach {
4141 try {
42- responseHeaders.put( it.key, it.value.joinToString(" , " ) )
42+ responseHeaders[ it.key] = it.value.joinToString(" , " )
4343 } catch (_: Exception ){}
4444 }
4545 val bodyResult = String (bytes)
Original file line number Diff line number Diff line change @@ -193,6 +193,22 @@ class CommandsManager {
193193 return answer
194194 }
195195
196+ fun writeDelete (): RequestResponse {
197+ val uri = " ${if (tlsEnabled) " https" else " http" } ://$host :$port /$path "
198+ val headers = mutableMapOf<String , String >().apply {
199+ if (! token.isNullOrEmpty()) put(" Authorization" , " Bearer $token " )
200+ }
201+ return Requests .makeRequest(
202+ uri,
203+ " DELETE" ,
204+ headers,
205+ null ,
206+ timeout,
207+ tlsEnabled,
208+ certificates
209+ )
210+ }
211+
196212 private suspend fun getStunCandidates (
197213 socketType : SocketType ,
198214 stunHost : String ,
You can’t perform that action at this time.
0 commit comments