MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / makeInputHandler

Method makeInputHandler

modules/clibridge/clibridge.go:317–340  ·  view source on GitHub ↗
(connId connections.ConnectionId)

Source from the content-addressed store, hash-verified

315}
316
317func (m *CLIBridgeModule) makeInputHandler(connId connections.ConnectionId) connections.InputHandler {
318 return func(ci *connections.ClientInput, handlerState map[string]any) bool {
319 sess := m.getSession(connId)
320 if sess == nil {
321 return true
322 }
323
324 if len(ci.DataIn) > 0 {
325 sess.mu.Lock()
326 if sess.PtyFile != nil {
327 sess.PtyFile.Write(ci.DataIn)
328 }
329 sess.mu.Unlock()
330 }
331
332 ci.DataIn = ci.DataIn[:0]
333 ci.Buffer = ci.Buffer[:0]
334 ci.EnterPressed = false
335 ci.TabPressed = false
336 ci.BSPressed = false
337
338 return false
339 }
340}
341
342func (m *CLIBridgeModule) ptyToClient(sess *Session) {
343 buf := make([]byte, 4096)

Callers 1

onCLIRequestMethod · 0.95

Calls 4

getSessionMethod · 0.95
LockMethod · 0.80
UnlockMethod · 0.80
WriteMethod · 0.65

Tested by

no test coverage detected